Home >Backend Development >PHP Tutorial >laravel 设置Cookies不生效

laravel 设置Cookies不生效

WBOY
WBOYOriginal
2016-06-06 20:34:112039browse

<code>        cookie('admin_username',123,45000);
        dd(cookie('admin_username'));
</code>

打印出来为Null

这是为什么?

也尝试过Cookie:make Cookie:get
获取的都是Null

回复内容:

<code>        cookie('admin_username',123,45000);
        dd(cookie('admin_username'));
</code>

打印出来为Null

这是为什么?

也尝试过Cookie:make Cookie:get
获取的都是Null

在响应里设置response('')->withCookie(cookie('name','laravel',1000))

cookie要下次打开页面才生效吧

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn