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


PHP iPHP::mobile方法代码示例

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


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

示例1: multiple_device

 /**
  * 多终端适配
  * @param  [type] &$config [系统配置]
  * @return [type]          [description]
  */
 private static function multiple_device(&$config)
 {
     $template = $config['template'];
     $_device = iPHP::PG('device');
     if ($_device) {
         /**
          * 判断指定设备
          * @var [type]
          */
         foreach ((array) $template['device'] as $key => $device) {
             if ($device['tpl'] && ($device['ua'] == $_device || $device['name'] == $_device)) {
                 $device_name = $device['name'];
                 $device_tpl = $device['tpl'];
                 $domain = $device['domain'];
                 break;
             }
         }
     }
     /**
      * 无指定设备 判断USER_AGENT
      */
     if (empty($device_tpl)) {
         foreach ((array) $template['device'] as $key => $device) {
             if ($device['tpl'] && self::device_agent($device['ua'])) {
                 $device_name = $device['name'];
                 $device_tpl = $device['tpl'];
                 $domain = $device['domain'];
                 break;
             }
         }
     }
     iPHP::$mobile = false;
     if ($device_tpl) {
         //设备模板
         $def_tpl = $device_tpl;
     } else {
         //检查是否移动设备
         if (self::device_agent($template['mobile']['agent'])) {
             iPHP::$mobile = true;
             $mobile_tpl = $template['mobile']['tpl'];
             $device_name = 'mobile';
             $def_tpl = $mobile_tpl;
             $domain = $template['mobile']['domain'];
         }
     }
     if (empty($def_tpl)) {
         $device_name = 'desktop';
         $def_tpl = $template['desktop']['tpl'];
         $domain = false;
     }
     define('iPHP_ROUTER_URL', $config['router']['URL']);
     $domain && ($config['router'] = str_replace($config['router']['URL'], $domain, $config['router']));
     define('iPHP_DEFAULT_TPL', $def_tpl);
     define('iPHP_MOBILE_TPL', $mobile_tpl);
     define('iPHP_DEVICE', $device_name);
     define('iPHP_HOST', $config['router']['URL']);
     header("Access-Control-Allow-Origin: " . iPHP_HOST);
     header('Access-Control-Allow-Headers: X-Requested-With,X_Requested_With');
 }
开发者ID:sunhk25,项目名称:iCMS,代码行数:64,代码来源:iPHP.class.php

示例2: multiple_device

 private static function multiple_device(&$config)
 {
     $template = $config['template'];
     foreach ((array) $template['device'] as $key => $device) {
         if ($device['tpl'] && self::device_agent($device['ua'])) {
             $device_name = $device['name'];
             $device_tpl = $device['tpl'];
             $domain = $device['domain'];
             break;
         }
     }
     iPHP::$mobile = false;
     //检查是否移动设备
     if (self::device_agent($template['mobile']['agent'])) {
         iPHP::$mobile = true;
         $mobile_tpl = $template['mobile']['tpl'];
         $domain = $template['mobile']['domain'];
     }
     if ($device_tpl) {
         //设备模板
         $def_tpl = $device_tpl;
     } else {
         if (iPHP::$mobile) {
             //没有设置设备模板 但是移动设备
             $device_name = 'mobile';
             $def_tpl = $mobile_tpl;
         }
     }
     if (empty($def_tpl)) {
         $device_name = 'desktop';
         $def_tpl = $template['desktop']['tpl'];
         $domain = false;
     }
     $domain && ($config['router'] = str_replace($config['router']['URL'], $domain, $config['router']));
     define('iPHP_DEFAULT_TPL', $def_tpl);
     define('iPHP_MOBILE_TPL', $mobile_tpl);
     define('iPHP_DEVICE', $device_name);
     define('iPHP_HOST', $config['router']['URL']);
     header("Access-Control-Allow-Origin: " . iPHP_HOST);
     header('Access-Control-Allow-Headers: X-Requested-With,X_Requested_With');
 }
开发者ID:World3D,项目名称:iCMS,代码行数:41,代码来源:iCMS.class.php


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