关闭浏览器时销毁CakePHP会话

alb*_*ore 2 browser session cakephp

为了Ajax的原因,我需要将Security.level设置在medium上.但我希望如果用户关闭浏览器,他的会话将会破坏.我怎样才能做到这一点?

提前致谢!

小智 6

配置/ core.php中

Configure::write('Session', array(
    'defaults' => 'php',
    'cookieTimeout' => 0,   //Lives until the browser is closed.
    'checkAgent'  => false  //To fix a little the Chrome Frame problem
));
Run Code Online (Sandbox Code Playgroud)