路由重复 模块不存在

报错

 

估计是里面路由一样  由于赶项目 临时处理办法如下

 Route::get('about/', 'Index/about');//关于吉谷
        Route::get('news/:nc_id', 'News/index',  [],['nc_id' => '\d+']);
        Route::get('newsDetail/:id', 'News/detail',['ext'=>'html'], ['id' => '\d+']);
        Route::get('product/', 'Product/index');
        Route::get('join/:type', 'Index/join',  [],['type' => '\d+']);// 1 诚聘英才  2 联系我们
        Route::get('join/', 'Index/join');// 1 诚聘英才  2 联系我们

 

 

 

解决办法  加个  判断 是否是pc  还是手机端

strpos(strtolower(($_SERVER['HTTP_HOST'])),$MobDomain)

 

$WebDomain = "www.dome.com";//pc端
$MobDomain = "m.dome.com";//手机端


Route::domain($WebDomain,'index');
Route::domain($MobDomain,'mobile');




//访问的是pc  还是手机端    解决 报错:模块不存在:mobile 
if(strpos(strtolower(($_SERVER['HTTP_HOST'])),$MobDomain) !== false){
    Route::group(['prefix' => 'mobile/'], function () {
//        Route::get('/', 'Index/index');
        Route::get('about/', 'Index/about');//关于吉谷
        Route::get('news/:nc_id', 'News/index',  [],['nc_id' => '\d+']);
        Route::get('newsDetail/:id', 'News/detail',['ext'=>'html'], ['id' => '\d+']);
        Route::get('product/', 'Product/index');
        Route::get('join/:type', 'Index/join',  [],['type' => '\d+']);// 1 诚聘英才  2 联系我们
        Route::get('join/', 'Index/join');// 1 诚聘英才  2 联系我们

    },['domain' => $MobDomain]);
}else{

    Route::group(['prefix' => 'index/'], function () {
//        Route::get('/', 'Index/index');
        Route::get('about/', 'Index/about');//关于吉谷
        Route::get('news/:nc_id', 'News/index',  [],['nc_id' => '\d+']);
        Route::get('newsDetail/:id', 'News/detail',['ext'=>'html'], ['id' => '\d+']);
        Route::get('product/', 'Product/index');
        Route::get('join/:type', 'Index/join',  [],['type' => '\d+']);// 1 诚聘英才  2 联系我们
        Route::get('join/', 'Index/join');// 1 诚聘英才  2 联系我们

    },['domain' => $WebDomain]);


}

 

转载于:https://www.cnblogs.com/wen-zi/p/9792532.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值