TP5框架学习心得————(路由配置)

在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’),


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值