简体   繁体   English

CakePHP 2.x中缺少身份验证会话

[英]Missing Auth Session in CakePHP 2.x

Here is my problem: on one specific page I get only blank white page, without any errors and messages. 这是我的问题:在一个特定的页面上,我只有空白的白页,没有任何错误和消息。 When I allow this page using $this->Auth->allow(); 当我使用$ this-> Auth-> allow();允许该页面时; method I see, that $this->Auth->user(); 我看到的方法是$ this-> Auth-> user(); return nothing. 一无所获。 And, this I see this problem only on this page. 而且,我仅在此页面上看到此问题。

Can you help me ? 你能帮助我吗 ?

Code: 码:

function beforeFilter() {
    parent::beforeFilter();     

    $this->flatVariables();

    $this->Auth->allow('search','view');
}
function edit() {
    debug($this->Auth->user());
    exit();
}

PS Sorry for english. PS对不起,英语。

Check for below possibilities. 检查以下可能性。

  1. Check if u wrote layout = ajax in controller. 检查您是否在控制器中编写了layout = ajax。
  2. check if u wrote autoRender = false in controller. 检查您是否在控制器中写了autoRender = false。
  3. check if u just exit out of script while debugging. 检查您是否在调试时退出脚本。
  4. and more important set debug mode to 2 so u will notify for possible error. 并且更重要的是将调试模式设置为2,这样您将通知可能的错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM