在application/route.php加上
‘:action/:c/:a’=> ‘:action/:c/:a’,
config.php:
// 是否开启路由
’url_route_on’ => true,
在入口文件中添加:
// 定义应用目录
define(‘APP_PATH’, DIR . ‘/…/application/’);
//开启域名部署后
// exit($_SERVER[‘HTTP_HOST’]);
switch ($_SERVER[‘HTTP_HOST’]) {
case ‘secret.tool.com’:
$model = ‘index/Secret/index’; // 生成随机密码模块
$route = false;// 开启路由
break;
case ‘picture.tool.com’:
$model = ‘index/picture/index’;// 压缩图片模块
KaTeX parse error: Expected 'EOF', got '}' at position 38: … break; }̲; define('BIND_…model);
// 加载框架引导文件
require DIR . ‘/…/thinkphp/start.php’;
如果要实现多个域名指向多个模块
在config.php中添加
开启路由
'url_route_on' => true,
\think\Route::domain(‘secret.tool.com’,‘index/Secret/index’), //模块名
\think\Route::domain(‘picture.tool.com’,‘index/Picture/index’),