Undefined variable: _SESSION [APP\Controller\UsersController.php in cakephp 2.0
已将会话组件纳入
UsersController var $components = array('Session', 'Cookie');
代码就是:
if(!empty($id))
{
print "<br><pre>";
print_r($_SESSION['text']);
print "<br><pre>";
print_r($this->Session->read("captchatext"));
die;
}
else
{
$_SESSION['text'] = "jjsssssjj";
$this->Session->write("captchatext", "ddddddssssssssssdddd");
print "ddddddssssssssssdddd";
}
答案 0 :(得分:0)
尝试
public $components = array('Session');
为什么不使用cakephp语法来读取会话,如:
print "<br><pre>";
print_r($this->Session->read('text'));
print "<br><pre>";