在 Laravel 5.4 中保存模型后出现 cURL 错误 3:<url> 格式错误(参见 http://curl.haxx.se/libcurl/c/libcurl-errors.html)错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/45392695/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 17:48:08  来源:igfitidea点击:

Getting cURL error 3: <url> malformed (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) error after saving models in laravel 5.4

laravelcurlrequestlaravel-5.4

提问by Jay Marz

I am having this error cURL error 3: <url> malformed (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)after saving/creating multiple models to database.

cURL error 3: <url> malformed (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)将多个模型保存/创建到数据库后出现此错误。

I have this in my controller:

我的控制器中有这个:

public function storeTruck(Request $request){
    //Save Company Detail
    $company = Company::Create($request->only(['company']));
    // Save Trucker Info
    $request->request->add(['password'=>bcrypt('trucker')]);
    $request->request->add(['company_id'=>$company->id]);
    $trucker = Trucker::create( $request->only([
        'first_name','last_name','company',
        'email','contact', 'password', 'company_id'
    ]));
    return view('admin.truck.list'); 
}

Those models are saved successfully in database but it will then proceed to a cURL error 3problem. What causes this error based on the codes? Please advice. Thanks.

这些模型已成功保存在数据库中,但随后会出现cURL error 3问题。根据代码导致此错误的原因是什么?请指教。谢谢。

回答by KPK

This error is due to the URL is not correct. Check the cURL error 3: check this link

此错误是由于 URL 不正确造成的。检查 cURL 错误 3:检查此链接