设置为数据库时,我无法从Cake php会话中读取值,它将返回null。Cake PHP 2.5.2。从数据库读取的会话
我在core.php中
Configure::write('Session', array(
'defaults' => 'database'
));
设置我已经建立了CakePHP的会话表,它在表中存储会话数据。
我尝试用
$pid = $this->Session->read('Projectid');
读回我
$this->Session->write('Projectid', key($projects));
任何想法写呢? 它在使用php会话而不是数据库时有效。
数据库的SQL
CREATE TABLE IF NOT EXISTS `cake_sessions` (
`id` varchar(255) NOT NULL,
`data` text,
`expires` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
UPDATE
我发现,如果我删除开单到会话一条线,它可以读取其他variables.Is这一个错误?
$projects = $this->Project->find('list', array('fields' => array('id','name')
$this->Session->write('Projects', $projects); //removing this line i can read
感谢您的回答,但我发现问题实际上是看到我的答案 – tsukimi