top-think / think-multi-app

thinkphp6 multi app support

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

多应用模式下,默认应用路由不生效

onenine-top opened this issue · comments

  • 路由配置开启强制路由模式
  • 路由文件app/home/route/route.php:
<?php

use think\facade\Route;

Route::get('/', 'Index');

Route::get('dd', 'Index/hd');

  • app/home/controller/Index.php文件
<?php

declare(strict_types=1);

namespace app\home\controller;

class Index {
    public function index() {
        return '您好!这是一个[home]示例应用';
    }
    public function hd() {
        return '您好!这是一个[home hd]示例应用';
    }
}

访问URL,http://127.0.0.1:8000 时可以正常访问
但是访问http://127.0.0.1:8000/dd 时,提示路由未定义
image

通过入口文件http://127.0.0.1:8000/home/dd访问正常
image

多应用的路由都是独立的 没有所谓的默认应用的概念

image
如图所示:
config/app.php这个默认应用代表什么,在多应用下面,应该是这个生效的吧?
还是说上图所设定的默认应用只针对单应用模式?如果之针对单应用模式,为什么还出一个默认应用的设置?

劳动节Happly~