当前位置: 首页>>代码示例>>PHP>>正文


PHP Agent::isTablet方法代码示例

本文整理汇总了PHP中Agent::isTablet方法的典型用法代码示例。如果您正苦于以下问题:PHP Agent::isTablet方法的具体用法?PHP Agent::isTablet怎么用?PHP Agent::isTablet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Agent的用法示例。


在下文中一共展示了Agent::isTablet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isMobile

function isMobile()
{
    return Agent::isMobile() || Agent::isTablet();
}
开发者ID:vanderlin,项目名称:halp,代码行数:4,代码来源:HelperFunctions.php

示例2: getView

 public function getView($slug)
 {
     if (Agent::isMobile() || Agent::isTablet()) {
         switch ($slug) {
             case "film":
                 return Redirect::to('film-mobile');
                 break;
             case "animation":
                 return Redirect::to('animation-mobile');
                 break;
             case "game-production":
                 return Redirect::to('game-mobile');
                 break;
             case "recording-arts":
                 return Redirect::to('recording-arts-mobile');
                 break;
             case "mp":
                 return Redirect::to('mp-mobile');
                 break;
             case "entertainment-business":
                 return Redirect::to('business-mobile');
                 break;
             case "entertainment-business-online":
                 return Redirect::to('entertainment-business-online-mobile');
                 break;
             case "digital-filmmaking":
                 return Redirect::to('digital-filmmaking-mobile');
                 break;
             case "military":
                 return Redirect::to('omni-mobile');
                 break;
             case "omni":
                 return Redirect::to('omni-mobile');
                 break;
         }
     } elseif (!Agent::isMobile() && !Agent::isTablet()) {
         switch ($slug) {
             case "film-mobile":
                 return Redirect::to('film');
                 break;
             case "animation-mobile":
                 return Redirect::to('animation');
                 break;
             case "game-mobile":
                 return Redirect::to('game-production');
                 break;
             case "recording-arts-mobile":
                 return Redirect::to('recording-arts');
                 break;
             case "mp-mobile":
                 return Redirect::to('mp');
                 break;
             case "business-mobile":
                 return Redirect::to('entertainment-business');
                 break;
             case "digital-filmmaking-mobile":
                 return Redirect::to('digital-filmmaking');
                 break;
             case "entertainment-business-online-mobile":
                 return Redirect::to('entertainment-business-online');
                 break;
             case "omni-mobile":
                 return Redirect::to('omni');
                 break;
         }
     }
     $landingpage = $this->landingpage->where('slug', '=', $slug)->first();
     // Check if the blog post exists
     if (is_null($landingpage)) {
         // If we ended up in here, it means that
         // a page or a blog post didn't exist.
         // So, this means that it is time for
         // 404 error page.
         //return App::abort(404);
         return 'DAMN!';
     }
     // Get variants
     $variants = $landingpage->variants($landingpage->id);
     $lpcount = $this->landingpage->sumallhits($landingpage->id);
     if ($lpcount == 0) {
         $lpcount = 100;
     }
     $v = array();
     foreach ($variants as $var) {
         $hit = $this->landingpage->sumhits($var->id);
         $varperc = $hit / $lpcount;
         $percent = $var->percent / 100;
         if ($varperc < $percent) {
             $vid = $var->id;
             break;
         }
         $v[] = $var->id;
     }
     if (empty($vid)) {
         $key = array_rand($v);
         $vid = $v[$key];
     }
     //echo $vid;
     $varclass = new Variant();
     $variant = $varclass->findOrFail($vid);
//.........这里部分代码省略.........
开发者ID:bailey9005,项目名称:Laravel-For-Landing-Pages,代码行数:101,代码来源:LandingPagesController.php


注:本文中的Agent::isTablet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。