Blogger Information
Blog 81
fans 1
comment 0
visits 124097
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
larvael 获取的cookie值为null
有什么是忘不了的的博客
Original
1018 people have browsed it

在通过 setcookie('aaa','asdc');    设置cookie后获取的cookie值为null

dump( $request->cookie('aaa'));  # null

为什么会出现这样的问题。

    在laravel中默认cookie是被认为加密过得。而未被加密过得cookie则被laravel认为是无效的所以返回null

 只要在App\Http\Middleware\EncryptCookies.php设置好需要过滤的cookie,值就可以正常获取了。

protected $except = [
       	'aaa',
       	'bbb'
    ];


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post