【发布时间】:2018-02-11 05:39:06
【问题描述】:
我正在尝试使用 Postman 向 Laravel 项目发送发布请求,但收到“419 未知状态”响应
路由\web.php:
Route::post('/myaction', 'MymodelController@myaction');
app\Http\Controllers\MymodelController.php:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Mymodel;
class MymodelController extends Controller
{
function myaction()
{
return redirect('/');
}
}
为什么会这样?
同样的错误出现独立于myaction()的内容
【问题讨论】:
-
csrf?不,如何通过 Postman 发送? -
谢谢!解决方案是使用 api.php 而不是 web.php。 (请将其写为回复,以帮助其他观众)
标签: php laravel post controller postman