What's the easiest way to set 3 cookies in a controller action using Zend Framework 2?
I tried using php's setcookie function to set multiple cookies..
$domainName = '.something.com';
$expirationTime = 2592000 + time();
setcookie("cookie1", "abc", $expirationTime, '/', $domainName);
setcookie("cookie2", "def", $expirationTime, '/', $domainName);
setcookie("cookie3", "ghi", $expirationTime, '/', $domainName);
However, it seems to set only the last cookie, which is cookie3. So, I am wondering if Zend framework 2 has a way to set multiple cookies like the above?
Thanks,
$domainName = '.something.com';
$expirationTime = 2592000 + time();
$cookie1 = new Zend\Http\Cookie('cookie1',
'abc',
'$domainName',
$expirationTime,
'/path');
$cookie2 = new Zend\Http\Cookie('cookie1',
'def',
'$domainName',
$expirationTime,
'/path');
$cookie3 = new Zend\Http\Cookie('cookie1',
'ghi',
'$domainName',
$expirationTime,
'/path');
Something like this.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.