我希望我的家(View/Pages/home.ctp)成爲一個公共視圖,導致每次嘗試訪問時,將我重定向到/ users/login .. AppController.php :CakePHP AuthComponent如何讓特定視圖
public $components = array(
'Session',
'Auth' => array(
'loginRedirect' => array('controller' => 'users', 'action' => 'areaRestrita'),
'logoutRedirect' => array('controller' => 'users', 'action' => 'logout'),
'authError' => 'Você deve fazer login para ter acesso a essa área!',
'loginError'=> 'Combinação de usuário e senha errada!'
)
);
BeforeFilter:
public function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('index');
}
我該怎麼辦?我試圖在pagesController.php上放一個beforeFilter來允許('顯示'),但不起作用。
你可以把你的'beforefilter'回調代碼.. –
好吧,我更新了.. –
可能的重複[CakePHP在瀏覽應用程序的索引時仍然存在](http://stackoverflow.com/questions/18015096/cakephp -persists-to-log-in-when-browsing-apps-index) – ndm