Php Laravel 5.6 Ajax Post 500内部服务器错误

Php Laravel 5.6 Ajax Post 500内部服务器错误,php,jquery,ajax,laravel,laravel-5.6,Php,Jquery,Ajax,Laravel,Laravel 5.6,您好,我正在通过Ajax Post请求发送大字符串数据,它在本地主机上工作正常,但在live server上不工作。我正在发送一些图像数据,然后这些图像数据将在服务器上转换为图像。发送此数据花费了太多时间。平均数据大小在4到7 MB之间。您能否建议一种更好的方法,以便做得很快。事情也设置正确,我包括CSRF令牌和URL也很好,但不知道为什么会发生这个错误 错误=>状态代码:500内部服务器错误 我发送请求的控制器代码 $pid = $request->input('id');

您好,我正在通过Ajax Post请求发送大字符串数据,它在本地主机上工作正常,但在live server上不工作。我正在发送一些图像数据,然后这些图像数据将在服务器上转换为图像。发送此数据花费了太多时间。平均数据大小在4到7 MB之间。您能否建议一种更好的方法,以便做得很快。事情也设置正确,我包括CSRF令牌和URL也很好,但不知道为什么会发生这个错误

错误=>状态代码:500内部服务器错误

我发送请求的控制器代码

$pid    =  $request->input('id');
        $pt_id  =  $request->input('pt_id');
        $pname  =  $request->input('name');
        $isBack =  $request->input('isBack');
        $qty    =  $request->input('qty');
        $paper  =  $request->input('paper');
        $previewFront  =  $request->input('previewFront');
        $previewBack   =  $request->input('previewBack');
        $PrintDataFront  =  $request->input('PrintDataFront');
        $PrintDataBack   =  $request->input('PrintDataBack');
        $cart_item_id = uniqid();
        //Store Img Data
        $pf = str_replace('data:image/png;base64,', '', $previewFront);
        $pf = str_replace(' ', '+', $pf);
        $pf_n = $cart_item_id.'_f_.'.'png';
        \File::put(public_path(). '/cart_preview/' . $pf_n, base64_decode($pf));
        $pb = str_replace('data:image/png;base64,', '', $previewBack);
        $pb = str_replace(' ', '+', $pb);
        $pb_n = $cart_item_id.'_b_.'.'png';
        \File::put(public_path(). '/cart_preview/' . $pb_n, base64_decode($pb));
        $pdf = str_replace('data:image/png;base64,', '', $PrintDataFront);
        $pdf = str_replace(' ', '+', $pdf);
        $pdf_n = $cart_item_id.'_f_.'.'png';
        \File::put(public_path(). '/orders/' . $pdf_n, base64_decode($pdf));
        $pdb = str_replace('data:image/png;base64,', '', $PrintDataBack);
        $pdb = str_replace(' ', '+', $pdb);
        $pdb_n = $cart_item_id.'_b_.'.'png';
        \File::put(public_path(). '/orders/' . $pdb_n, base64_decode($pdb));
        //Get Prices and qty
        $opriceitem = PriceTableItem::find($qty);
        $itemQty = $opriceitem->qty;
        $basePrice = $opriceitem->total;
        if($isBack == 'true') {
            $backPrice =  $opriceitem->total_back;
            $itemPrice = $opriceitem->total + $opriceitem->total_back;
            $pricePerPiece = $opriceitem->item_price + $opriceitem->item_price_back;            
        }else {
            $backPrice =  'INCLUDED';
            $itemPrice = $opriceitem->total; 
            $pricePerPiece = $opriceitem->item_price; 
        }
        if($paper == 'Premium White') {
            $paperPrice = ($itemPrice/100) *60;
            $itemPrice = $itemPrice + ($itemPrice/100) *60;
        } else {
            $paperPrice = 'INCLUDED';
        }
        //Get all Available Qty
        $allQty = PriceTableItem::where('tid', $pt_id)->get();
        $allAvailableQty = array();
        foreach($allQty as $allqtyarry) {array_push($allAvailableQty, $allqtyarry->qty);}       
        //Create Cart Object
        $item = [
            "id"      => $cart_item_id,
            "pid"      => $pid,
            "name"    => $pname,
            "qty"     => $itemQty,
            "price_table_id"    => $pt_id,
            "paperType"  => $paper,
            "backCharges"  => $backPrice,
            "paperCharges"  => $paperPrice,
            "isBack" => $isBack,
            "pricePerPiece"    => $pricePerPiece,
            "basePrice"    => $basePrice,
            "totalPrice"    => $itemPrice,
            "allQty"    => $allAvailableQty,
        ];
        $request->session()->put('cart.items.' . $cart_item_id, $item);
        return 'Success';
大宗报价 你得到的只是错误500而不是别的吗?如果是,请启用调试,以便更好地描述错误。确保您的php.ini文件设置正确,并且服务器文件夹的权限正常(我总是发现存储文件夹有问题)


您的服务器上有图像吗?没有。服务器上没有保存图像。请考虑这个问题。PHP是服务器端代码。在代码中,您将获得.png文件。对吗?我知道php是服务器端代码。它在本地主机上运行良好,但在live server上不工作。在live server上,没有任何图像。如果你愿意,你应该上传图片。PHP代码无法从本地PC获取任何信息。