tp5框架配置域名路由以及在其中使用资源路由

对于配置域名路由; 你可以在你的路由文件中这样设置( 假设你现在有pc端要用www.test.com域名, 手机端要用m.test.com域名的需求)

 

<?php


//pc端路由
\think\Route::domain('www', [
    'messages' => ['admin/index/message', ['ext' => 'html']],
]);

//手机端路由
\think\Route::domain('m', [
    'messages' => ['mobile/index/message', ['ext' => 'html']],
]);

//在域名路由中使用资源路由
\think\Route::domain('www', function () {
    \think\Route::resource('questionforone', 'admin/QuestionForOne');
});

ps:

域名路由配置: 官网地址(https://www.kancloud.cn/manual/thinkphp5/118039)

资源路由配置: 官网地址(https://www.kancloud.cn/manual/thinkphp5/118035)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值