我第一次访问我的网站,我看到了服务器设置的会话 cookie。我正在重新加载页面,我看到只有我的浏览器将会话标识符发送到服务器,而服务器不返回会话 cookie。我正在使用 Kohana 框架。我想知道如果请求已经拥有会话cookie并且它没有过期或者这是由框架处理的,这是否是原生PHP行为不发送会话cookie?
我发现了以下一段代码,它可能具有魔力:
protected function _read($id = NULL)
{
// Sync up the session cookie with Cookie parameters
session_set_cookie_params($this->_lifetime, Cookie::$path, Cookie::$domain, Cookie::$secure, Cookie::$httponly);
// Do not allow PHP to send Cache-Control headers
session_cache_limiter(FALSE);
// Set the session cookie name
session_name($this->_name);
if ($id)
{
// Set the session id
session_id($id);
}
// Start the session
session_start();
// Use the $_SESSION global for storing data
$this->_data =& $_SESSION;
return NULL;
}
是我要找的吗?