Sessionhandler写不起作用?

时间:2017-06-30 11:06:45

标签: php symfony session

我使用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;
}

有什么问题?谢谢你的回复。

0 个答案:

没有答案