Php Sessionhandler写入不起作用?

Php Sessionhandler写入不起作用?,php,symfony,session,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

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

有什么问题吗。感谢您的回复。

这些代码片段在单独使用时没有多大意义(尽管没有任何错误检查/报告提示)。您的期望也不是只有在保存会话时,才应该编写会话。symcbean我应该怎么做?它是如何使用的?我认为@symcbean想要说的是,在调用构造函数的时间和地点,以及尝试在会话中添加条目的位置,应该添加更多的代码。您刚刚发布了一些孤立的函数,这些函数没有给出您在何处或如何使用它们的任何想法。