【发布时间】:2020-04-13 14:23:17
【问题描述】:
我正在尝试在我的 laravel 应用程序中使用 unirest 获取 API。我遵循了文档中给出的所有步骤,但它向我显示了一个错误。如果unirest 有更好的选择,请告诉我。提前致谢!
这是我的控制器,
public function store(Request $request)
{
Love::create(
request()->validate([
'name_1' => ['required','max:255'],
'name_2' => ['required','max:255'],
],
[
'name_1.required' => 'You have to Enter Your name',
'name_2.required' => 'You have to Enter Your Crush name'
]));
$headers = array('Accept' => 'application/json');
$response = Unirest\Request::post("API_URL",
array(
"X-RapidAPI-Key" => "API_KEY"
)
);
dd($response);
return view("result");
}
错误
找不到类“App\Http\Controllers\Unirest\Request”
【问题讨论】: