1、版本 5.0.18
2、在data/conf/ 新增config.php文件,内容如下:
$default_module, // 默认控制器名 'default_controller' => $default_controller, // 默认操作名 'default_action' => $default_action,];//判断是否 微信浏览器function isWeixin() { if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false) { return true; } else { return false; }}//判断是PC还是wapfunction isMobile(){ if (isset ($_SERVER['HTTP_X_WAP_PROFILE'])) return true; if(isset ($_SERVER['HTTP_CLIENT']) &&'PhoneClient'==$_SERVER['HTTP_CLIENT']) return true; if (isset ($_SERVER['HTTP_VIA'])) return stristr($_SERVER['HTTP_VIA'], 'wap') ? true : false; if (isset ($_SERVER['HTTP_USER_AGENT'])) { $clientkeywords = array( 'nokia','sony','ericsson','mot','samsung','htc','sgh','lg','sharp','sie-','philips','panasonic','alcatel','lenovo','iphone','ipod','blackberry','meizu','android','netfront','symbian','ucweb','windowsce','palm','operamini','operamobi','openwave','nexusone','cldc','midp','wap','mobile' ); if (preg_match("/(" . implode('|', $clientkeywords) . ")/i", strtolower($_SERVER['HTTP_USER_AGENT']))) { return true; } } if (isset ($_SERVER['HTTP_ACCEPT'])) { if ((strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') !== false) && (strpos($_SERVER['HTTP_ACCEPT'], 'text/html') === false || (strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') < strpos($_SERVER['HTTP_ACCEPT'], 'text/html')))) { return true; } } return false;}
3、效果:
如果是微信,默认输入ip或者域名,直接绑定到 user/Loing/index 页面
如果是wap,默认输入ip或者域名,直接绑定到 portal/Index/index 页面
其他情况,PC/IPAD, 均绑定至 默认的 config页面, admin/Index/index页面