最近一个项目要从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下的页面都正常,就是后台系统重定向郁闷
目录结构是:
立即学习“PHP免费学习笔记(深入)”;

尝试了修改pathinfo模式,看了nginx的重写模式都不行
解决方法:
用最笨的办法,从入口文件admin.php开始,一个一个跟踪打印并结束,看看哪里出了问题,类似小黄鸭调试法,呵呵
exit("123");
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号