我是新蛋糕3.0.我已阅读文档
http://book.cakephp.org/3.0/en/development/sessions.html
但我无法写会话.
http://book.cakephp.org/3.0/en/development/sessions.html
但我无法写会话.
use Cake\Network\Session\DatabaseSession; $session->write('Config.language','eng'); $session->read('Config.language');
你需要设置$session:
$session = $this->request->session(); $session->write('Config.language','eng'); $session->read('Config.language');
然后你就可以在你的会话中阅读和写作了
或者你可以直接读写:
$this->request->session()->write('Config.language','eng'); $this->request->session()->read('Config.language');