[英]Sessionhandler write does not work?
我使用symfony http-foundation / session在php中进行会话存储。我的问题是下面的代码。
/**
* Constructor.
* Make sure your PHP session isn't already started before using the Session class.
* If you have a legacy session system that starts your session
* Symfony sessions are designed to replace several native PHP functions.
* Applications should avoid using session_start(), session_regenerate_id(), session_id(),
* session_name(), and session_destroy() and instead use the APIs in the following section.
*/
public function __construct()
{
$storage = new NativeSessionStorage(array(), new NativeFileSessionHandler(application.'/storage/session'));
$this->session = new Session($storage);
$this->session->start();
}
会话文件已创建到指定目录。当我使用代码时,但是在设置任何数据时写入过程均不起作用。
/**
* {@set} .
* Sets an attribute by key.
*/
public function set($key=null,$value=null)
{
if($key!==null && $value!==null){
return $this->session->set($key,$value);
}
return false;
}
有什么问题? 。感谢您的回复。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.