lwQin

896 经验值

无法播放该视频,请换一个支持HTML5视频功能的浏览器
环境:Chrome58,win10

windows环境下,改日志模式为daily报500错误,使用debug模式不会,如何解决?

真不知道是哪里出问题了。。。试过吧环境从LNMP换成了LAMP,还是出现一样的报错。
查看session也发现提交前后出来两个不一样的token值

负载均衡?我环境是LNMP环境,和nginx的设置有关吗?

线上的服务器,我试过重新部署环境也是这个问题

5.2的,我现在直接DD,然后我看了下session里的token值,发现提交前后分别是两个不同的,这要怎么处理?

提交前

a:4:{s:6:"_token";s:40:"DOj01mDDBWNLJ11UWQ3LBgthXLPud5Lx4mCYF2pS";s:9:"_previous";a:1:{s:3:"url";s:28:"http://www.justonce.net/form";}s:9:"_sf2_meta";a:3:{s:1:"u";i:1481014874;s:1:"c";i:1481014874;s:1:"l";s:1:"0";}s:5:"flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}

提交后

a:3:{s:6:"_token";s:40:"zQOa0WiEdD9UFjKhNdHwEHwfMkAbqk3Dp5khKPC0";s:9:"_sf2_meta";a:3:{s:1:"u";i:1481014892;s:1:"c";i:1481014892;s:1:"l";s:1:"0";}s:5:"flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}

csrf_token提交时一直报错,查看源代码有隐藏的token值

源代码

<form method="post" action="/data">
        <input type="hidden" name="_token" value="XsRtQ4X8xMqlWRDpf1VgrStFTaxBAArdjfx0NyRd">
        <input type="text" name="name">
        <input type="submit" value="提交">
    </form>

错误提示

TokenMismatchException in VerifyCsrfToken.php line 67:
in VerifyCsrfToken.php line 67
at VerifyCsrfToken->handle(object(Request), object(Closure))
at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32

路由代码

Route::group(['middleware'=>'web'], function (){
    Route::get('/form', function(){
        return view('form');
    });
    Route::post('/data', function (){
        return dd($_POST);
    });
});

前端代码

<div class="container">
    <form method="post" action="/data">
          csrf_field()  
        <input type="text" name="name">
        <input type="submit" value="提交">
    </form>
</div>