【问题标题】:cakePhp redirect and Auth doesn't work on servercakePhp 重定向和身份验证在服务器上不起作用
【发布时间】:2012-07-16 15:42:17
【问题描述】:

我在登录 www 服务器时遇到问题。在 wamp(本地)上,一切都很好。当我在服务器上上传我的网站时,登录不起作用,我也看到了重定向。我有登录表单,点击登录后,它会转到用户控制器进行登录操作。 登录操作如下所示:

    public function login(){
        if($this->request->is('post')){
            if($this->Auth->login()){
                $this->redirect($this->referer());
            }
            else{

                $this->Session->setFlash(__('Wrong username or password'));
                $this->redirect($this->referer());
            }
        }
    }

无论成功与否,它都应该重定向。它停留在:用户/登录页面。有什么问题?

应用控制器:

public $components = array(
    'Session',
    'Auth'=>array(
        'logoutRedirect'=>array('controller'=>'main', 'action'=>'index')
    )
);

public function beforeFilter(){
    $this->Auth->allow();

}

表格:

<?php

    echo $this->Form->create('User',  array('action' => 'login'));
    echo $this->Form->input('username', array('label'=>__('Username:')));
    echo $this->Form->input('password', array('label'=>__('Password:')));
    echo $this->Form->end(__('Login'));

?>

【问题讨论】:

  • formAppController 代码在哪里?发布它们

标签: cakephp


【解决方案1】:

在一个文件上?&gt; 之后有一个空格.... 3 小时后我发现那很糟糕:)

【讨论】:

  • 在网上搜索工具来删除它或写一个:)
  • 空白在哪里?在哪一行?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-11-04
  • 1970-01-01
  • 1970-01-01
  • 2013-11-15
  • 1970-01-01
  • 1970-01-01
  • 2019-03-11
相关资源
最近更新 更多