码迷,mamicode.com
首页 > 其他好文 > 详细

路由重复 模块不存在

时间:2018-10-15 20:34:14      阅读:201      评论:0      收藏:0      [点我收藏+]

标签:联系   pos   www.   分享图片   alt   模块   UNC   strpos   判断   

报错

技术分享图片

 

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

 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]);


}

 

路由重复 模块不存在

标签:联系   pos   www.   分享图片   alt   模块   UNC   strpos   判断   

原文地址:https://www.cnblogs.com/wen-zi/p/9792532.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!