应用插件如何使用框架路由

七彩枫叶

问题描述

我准备开发一个cms应用插件,想要实现 http://domain/ 就能访问到这个cms的首页

我的想法是在config/route.php中,直接添加路由

<?php
use Webman\Route;
// 引用 route 中的路由文件
foreach (glob(base_path() . '/route/*.php') as $filename) {
    include_once $filename;
}
//Route::any('/', [app\controller\IndexController::class, 'index']);
Route::any('/', [plugin\cms\app\controller::class, 'index']);

// 关闭默认路由
//Route::disableDefaultRoute();

但是提示
Route / ["plugin\cms\app\controller","index"] is not callable
应该如何设置才能
domain/app/cms 隐藏 掉 app/cms 实现通过domain/访问到app/cms 的index内容

155 1 0
1个回答

Tinywan

这种最好使用Nginx代理

  • 暂无评论
🔝