我对我的应用程序的后curl请求有问题。目前,我正在使用laravel 5构建restful注册功能。这个例子的路径是在终端上使用curl函数传递值curl -d 'fname=randy&lname=tan&id_location=1&[email protected]&password=randytan&remember_token=Y&created_at=2015-03-03' localhost:8000/auth/register/这是我的routes.php这是我的函数来存储注册用户public function create() { //function to create user. $userAccounts = new User; $userAccounts->fname = Request::get('fname'); $userAccounts->lname = Request::get('lname'); $userAccounts->id_location = Request::get('id_location'); $userAccounts->email = Request::get('email'); $userAccounts->password = Hash::make(Request::get('password')); $userAccounts->created_at = Request::get('created_at'); $userAccounts->save(); return Response::json(array( 'error' => false, 'user' => $userAccounts->fname . " " . $userAccounts->lname ), 200); }执行上面的curl语法,我得到这个错误localhost:8000/user/create你有什么想法吗?因为我只在我的几个url中实现了中间件,而且这个curl注册url与任何身份验证机制都不紧密。谢谢你。 (adsbygoogle = window.adsbygoogle || []).push({}); 最佳答案 默认情况下,laravel 5在中间件中执行csfr令牌身份验证。您可以在选定的路径上禁用CSFR,这里是link或者你可以试试这些solutions。希望能有所帮助。更改csfr令牌方法/app/Http/Middleware/VerifyCsrfToken.php (adsbygoogle = window.adsbygoogle || []).push({});
10-07 13:09