Laravel 4 - 永远排队 cookie

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24691346/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 09:47:59  来源:igfitidea点击:

Laravel 4 - Queueing a cookie forever

cookieslaravellaravel-4

提问by Enrique Moreno Tent

In Laravel 4, is there a way to set a queuea cookie that last forever?

在 Laravel 4 中,有没有办法设置一个永远持续的 cookie队列

Basically I want to mix the functionality of:

基本上我想混合以下功能:

Cookie:queue()

and

Cookie:forever()

回答by Laurence

Cookie::queue($name, $value, 2628000)

If you look at the Cookie::forever()code, it defines "forever" as 2628000(five years)

如果您查看Cookie::forever()代码,它将“永远”定义为2628000(五年)

回答by Elf Sundae

 Cookie::queue(Cookie::forever($name, $value));
 return $response;

or

或者

$response = Response('hello');
$response->withCookie(Cookie::forever($name, $value));
return $response;