【发布时间】:2014-02-19 17:31:30
【问题描述】:
我使用 csrf,它在 safari 和 firefox 中运行良好(可以显示 POST 页面),但只能在 chrome 中获得 TokenMismatchException?有谁知道是什么问题?我试图清除捕获物,但它保持不变。
Routes.php
/*
| Unauthenticated group
*/
Route::group(array('before' => 'guest'), function(){
/*
| CSRF protection group
*/
Route::group(array('before' => 'csrf'), function(){
/*
| Create Account (POST)
*/
Route::post('/account/create', array(
'as' => 'account-create-post',
'uses' => 'AccountController@postCreate'
));
});
/*
| Create Account (GET)
*/
Route::get('/account/create', array(
'as' => 'account-create',
'uses' => 'AccountController@getCreate'
));
});
AccountController.php
<?php
class AccountController extends BaseController{
public function getCreate(){
return View::make('account.create');
}
public function postCreate(){
return 'Hello.';
}
}
create.blade.php
@extends('layouts.master')
@section('content')
<form action="{{ URL::route('account-create-post') }}" method="post">
<input type="submit" value="Create account">
{{ Form::token() }}
</form>
@stop
【问题讨论】:
-
仅在 chrome 上也发生在我身上,正在寻找解决方案:(
-
我的只是我没有在我的 chrome 中保留任何 cookie.. 所以会话令牌每次都更改
标签: php google-chrome laravel-4 token csrf