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

laravel 设置Cookies不生效

WBOY
Release: 2016-06-06 20:34:11
Original
2002 people have browsed it

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

打印出来为Null

这是为什么?

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

回复内容:

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

打印出来为Null

这是为什么?

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

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

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template