【发布时间】:2012-11-22 08:43:05
【问题描述】:
当我第一次创建 cookie 时,我似乎无法获取相同的 cookie,直到后续页面加载。就好像在第二次请求页面之前,浏览器不存在 cookie。
我正在使用 Kohana PHP 框架:
Cookie::set('new_cookie', 'I am a cookie');
$cookie = Cookie::get('new_cookie');
//$cookie is NULL the first time this code is run. If I hit the page again
and then call Cookie:get('new_cookie'), the cookie's value is read just fine.
所以,我被引导相信这是正常行为,并且我可能不了解 cookie 的工作原理。谁能帮我澄清一下?
【问题讨论】:
标签: php cookies browser kohana