If the开发者_如何学运维 Controller have the code $this->autoRender = false;
the session can't write.
function login() {
$this->autoRender = false;
$this->Session->write('Student', 'test');
}
If you're using CakePHP 1.3, You most likely have activated your Session Helper, but not your Session Component. Check the manual here. You'll need both of these, probably in your AppController:
public $components = array('Session');
public $helpers = array('Session');
or PHP4:
var $components = array('Session');
var $helpers = array('Session');
精彩评论