我使用core.PHP在30分钟后注销:
Configure::write('Session',array( 'defaults' => 'PHP','timeout' => 30,// auto logout after 30 minutes 'cookieTimeout' => 1440,// session cookie 24 hours 'autoRegenerate' => true // regenerate session ));
这工作很好.我会显示会话超时的倒计时消息,例如在注销按钮旁边的页眉中.有人能帮助我吗?
例如,在default.ctp中.
<body> <div id="container"> <div id="header"> <div style="float: right;"> <?PHP // display countdown of session timeout: // You will be automatically logged off for (time to expire cookie timeout) // logout button echo $this->Html->link(__('logout'),array('controller' => 'users','action' => 'logout'),array('escape' => false)); ?> </div> </div> <div id="content"> </div> </div>