Home  >  Article  >  Backend Development  >  Regarding server deployment thinkphp3.1.3 has too many redirects

Regarding server deployment thinkphp3.1.3 has too many redirects

PHP中文网
PHP中文网Original
2017-03-23 09:39:192293browse

A recent project needs to be migrated from window to linux. There is no problem when running locally. However, when testing on linux, when entering the backend system (admin.php), an error message appears. The website has too many redirects.

The loading process is admin.php As the entry file, the index controller inherits baseAction, and baseAction has the following code

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');
        }
    }

The code of the Login controller

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');
    }

Theoretically, loginAction does not inherit baseAction, so it will not redirect. However, the website still prompts me that there are too many redirects. Orientation, but the pages under the front-end index.php are normal, but the back-end system redirection is frustrating

The directory structure is:

Regarding server deployment thinkphp3.1.3 has too many redirects

I tried to modify the pathinfo mode, but it didn’t work after looking at nginx’s rewrite mode

Solution:

Use the stupidest method, start from the entry file admin.php, trace and print one by one and end it to see where the problem is, similar to the little yellow duck debugging method, haha

exit("123");
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn