0

使用 Laravel 4。

我有一个过滤器:

Route::filter('csrf', function()
{
  if (Request::forged()) return Response::error('500');
});

在控制器中,我为 POST 请求调用过滤器:

public function __construct()
{
  $this->beforeFilter('csrf', array('on' => 'post'));
}

但是当我发布时出现此错误:

Call to undefined method Illuminate\Http\Request::forged()

谁能给我一些关于出了什么问题的见解?

4

1 回答 1

1

你的例子是指 Laravel 3。在这里你应该如何在 Laravel 4 上使用它https://github.com/laravel/laravel/blob/master/app/filters.php#L74-L80

于 2013-06-30T14:43:32.193 回答