tp5.0.24核心板 默认路由设置 开启后无限重定向

浏览:867 发布日期:2019/08/01 分类:ThinkPHP5专区 关键字: 路由问题
tp5.0.24核心板

config.php 就是默认路由设置    // 是否开启路由
    'url_route_on'           => true,
    // 是否强制使用路由
    'url_route_must'         => false,
route.php<?php
use think\Route;
Route::rule([
    'admin' => 'admin/Home/index'
]);
application下 有admin模块 该模块下有三个控制器 分别是Login Home base/*Login*/
<?php
namespace app\admin\controller;
use think\Controller;

class Login extends Controller{
    public function index(){
        return $this->fetch();
    }
}
/*Home*/
<?php
namespace app\admin\controller;

class Home extends Base{
    public function index(){
        return $this->fetch();
    }
}
/*Base*/
<?php
namespace app\admin\controller;
use think\Controller;

class Base extends Controller{
    public function __construct()
    {
        parent::__construct();
        $this -> checkSession();
    }

    public function checkSession(){
        $userSession = session("user");
        if(!$userSession || empty($userSession) || is_null($userSession['id'])){
            $this->redirect("admin/Login/index");
        }
    }
}
访问http://localhost/test/admin/home/index
该网页无法正常运作 localhost 将您重定向的次数过多。
打开控制台定位network 是一大堆302跳转


如果是访问http://localhost/test/admin/login/index 也是这样
ps:已经把原public文件下index.php和伪静态文件放到项目根目录了


为了方便各位大佬帮我看一下这个问题 可以从这里获取
https://github.com/yang-vapaad/test.git
多谢!!!
最佳答案
评论( 相关
后面还有条评论,点击查看>>