私UserController.phpは、私はでvar_exportはまだすべて表示する "ログアウト" をクリックすると、この
function logout()
{
$this->Session->destroy('User');
$this->Session->setFlash('You\'ve successfully logged out.');
var_export($this->Session->read('User'));
//$this->redirect('login');
}
私の見解ユーザ/ index.ctp
<?php echo $this->Html->link('Logout', array('controller' => 'users', 'action' => 'logout')); ?>
のように見える機能をログアウトしましたユーザーデータとIは、ユーザーに戻った場合/それはまだ私にユーザーが設定されている場合は、私の私のUserController.phpに私がチェックしていていても、そのページを示しindex.ctp
function beforeFilter()
{
$this->__validateLoginStatus();
}
function __validateLoginStatus()
{
if($this->action != 'login' && $this->action != 'logout')
{
if($this->Session->check('User') == false)
{
$this->redirect('login');
}
}
ログインページにリダイレクトされず、インデックスページに移動します。 }
$ this-> Session-> destroy( 'User'); $ this-> Session-> delete( 'User')と$ this-> Session-> destroy( 'User')の違いは何ですか? –