I am trying to set a cookie in a symfony2 project.
Everything is working fine, except that the cookie is deleted once the browser is closed. I tried to set an expiration time but it throws an error : Expiry date cannot have a year greater then 9999
我怎样才能修好它?
这是我的代码:
$time = time() * 3600 * 24 * 7;
$response = new Response();
$response->headers->setCookie(new Cookie( lang , $lang, $time));
$response->send();