Thinkphp thinkcmf5 判断IE浏览器 切换前端模板


class ListController extends HomeBaseController
{
   public function index()
   {
      $id = $this->request->param('id',0,'intval');
     $portalCategoryModel = new PortalCategoryModel();
     $category = $portalCategoryModel->where('id',$id)->where('status',1)->find();
     $this->assign('category',$category);
     $listTpl = empty($category['list_tpl']) ? 'list' : $category['list_tpl'];


     if($listTpl == 'ibasso_list'|| $listTpl == 'tableware_list'){
        $listTpl = $this->isIE() ? 'ie_'.$listTpl : $listTpl;
     }
     return $this->fetch('/'.$listTpl);
     
   }

   public function isIE() {
       $isIE = strpos($_SERVER['HTTP_USER_AGENT'],"Triden");
       return $isIE;
   }

}