Maison  >  Article  >  développement back-end  >  关于服务器部署thinkphp3.1.3重定向过多

关于服务器部署thinkphp3.1.3重定向过多

PHP中文网
PHP中文网original
2017-03-23 09:39:192255parcourir

最近一个项目要从window迁移到linux下,本地运行的时候没问题,但在linux测试的时候,进入后台系统(admin.php)就报错网站的重定向过多

加载流程是admin.php作为入口文件,index控制器继承baseAction,baseAction有如下的代码

class IndexAction extends BaseAction {

    public function index() {
    //indexAction.class.php
    }
 }
    
    
class BaseAction extends Action {
//BaseAction.class.php
   public function _initialize() {
        if (!$this->isLogin()) {
            $this->redirect('Home/Login/index');
        }
    }

Login控制器的代码

class LoginAction extends Action {

    /**
     * 显示登录页面
     */
    public function index() {
        if (!empty($_SESSION[C('SESSION_ADMIN_NAME')]) && !empty($_SESSION[C('SESSION_ADMIN_ID')]) && strtolower(ACTION_NAME) != 'logout') {
            $this->redirect("Index/index");
        }
        $this->display('login');
    }

理论上loginAction不继承baseAction所以不会重定向的啊,但是网站还是提示我有过多的重定向,但是前台index.php下的页面都正常,就是后台系统重定向郁闷

目录结构是:

3058122961-57fafd307938f_articlex.png

尝试了修改pathinfo模式,看了nginx的重写模式都不行

解决方法:

用最笨的办法,从入口文件admin.php开始,一个一个跟踪打印并结束,看看哪里出了问题,类似小黄鸭调试法,呵呵

exit("123");
Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn