application->common.php(应用公共文件)
判断访问设备
if (Request::instance()->isMobile()) {
define(‘VIEW_PATH’,’./template/mobile/’);
} else {
define(‘VIEW_PATH’,’./template/pc/’);
}
config->template.php(模板配置文件)
// 模板路径
‘view_path’ => VIEW_PATH,
public下新建对应文件夹
tp5.0的话可直接在config.php配置,模板设置
‘view_path’ => \think\Request::instance()->isMobile()?’./template/mobile/’:’./template/pc/’,