我在移动设备,特别是iOS方面遇到了一些问题,当我登录到我的应用程序或搜索具有令牌的表单上的东西时,我得到照亮'Session'TokenMismatchException上的filters.php行88有
Route::filter('csrf', function() {
if(Session::token() !== Input::get('_token')) {
throw new Illuminate'Session'TokenMismatchException;
}
});
控制器登录代码:
$auth = Auth::attempt(array(
'email' => Input::get('username'),
'password' => Input::get('password')
), true);
if($auth){
# Redirect to intended page
return Redirect::intended('/dashboard');
} else {
return Redirect::route('signin')
->with('global-error','Incorrect email or password.');
}
HTML页面上的表单标签代码:
<form method="post" action="{{ URL::route('signin-post') }}">
<!-- Token is echoed like this: -->
{{ Form::token() }}
有什么办法可以解决这个问题吗?在PC和Android设备上运行良好,如果我删除过滤器,它在iOS上运行良好,否则我会得到异常。
更多细节:
- 这发生在两个不同的项目 我使用的是Laravel 4.2和PHP 5.5.6
Thanks in advance
这是因为Safari正在阻止cookie。