我有一个问题与烬发布到我的Laravel API。我不断得到COR的错误,当我尝试添加适当的标题到我的商店方法的错误仍然存在。我已经研究了一个小时了,没有结果。任何帮助都将非常感激。下面是我的store()方法的代码…
$statusCode = 200;
$libraries = $request->all();
$library = Library::create($libraries);
$criteria = $library->toArray();
return Response::json([
'library' => $criteria],
$statusCode);
试着这样做
http/中间件/VerifyCsrfToken.phproute start with API是允许的
e。g myapp.com/api/login
public function handle($request, Closure $next)
{
if (!$request->is('api/*'))
{
return parent::handle($request, $next);
}
return $next($request);
}