• About Me




    Lily@Melbourne, Australia

    Login

  • Follow 静水深流 || Still waters run deep on WordPress.com
  • Archives

CakePHP: 小细节

今天designer跟我说首页显示不了当前的用户名。经检测所有静态页的都不能显示,也就是说使用pagescontroller的都有问题,很小的个问题,但却很棘手,因为这个controller是Cakephp自带地。
解决办法在PagesController下加上这个function

public function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow( ‘*’ );
}

如果在AppController上有类似Code的话,删除

if ($this->params[‘controller’] == ‘pages’) {
$this->Auth->allow(‘*’);
}

Done!

 

 

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: