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


PHP Mobile_Detect::getUtilities方法代码示例

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


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

示例1: testRulesExtended

 /**
  * @covers Mobile_Detect::getMobileDetectionRulesExtended
  */
 public function testRulesExtended()
 {
     $md = new Mobile_Detect();
     $count = array_sum(array(count(Mobile_Detect::getPhoneDevices()), count(Mobile_Detect::getTabletDevices()), count(Mobile_Detect::getOperatingSystems()), count(Mobile_Detect::getBrowsers()), count(Mobile_Detect::getUtilities())));
     $md->setDetectionType(Mobile_Detect::DETECTION_TYPE_EXTENDED);
     $rules = $md->getRules();
     $this->assertEquals($count, count($rules));
 }
开发者ID:kennygrage,项目名称:dynastyDish,代码行数:11,代码来源:BasicsTest.php

示例2: dirname

 * Use the resulting JSON export file in other languages
 * other than PHP. Always check for 'version' key because
 * new major versions can modify the structure of the JSON file.
 *
 * The result of running this script is the export.json file.
 *
 * @license     Code and contributions have 'MIT License'
 *              More details: https://github.com/serbanghita/Mobile-Detect/blob/master/LICENSE.txt
 *
 */
// Included nicejson function to beautify the result JSON file.
// This library is not mandatory.
if (file_exists(dirname(__FILE__) . '/nicejson/nicejson.php')) {
    include_once dirname(__FILE__) . '/nicejson/nicejson.php';
}
// Include Mobile Detect.
require_once dirname(__FILE__) . '/../Mobile_Detect.php';
$detect = new Mobile_Detect();
$json = array('version' => $detect->getScriptVersion(), 'headerMatch' => $detect->getMobileHeaders(), 'uaHttpHeaders' => $detect->getUaHttpHeaders(), 'uaMatch' => array('phones' => $detect->getPhoneDevices(), 'tablets' => $detect->getTabletDevices(), 'browsers' => $detect->getBrowsers(), 'os' => $detect->getOperatingSystems(), 'utilities' => $detect->getUtilities()));
$jsonString = function_exists('json_format') ? json_format($json) : json_encode($json);
// Write the JSON file to disk.
// You can import this file in your app.
$fileName = dirname(__FILE__) . '/../Mobile_Detect.json';
$handle = fopen($fileName, 'w');
$fwrite = fwrite($handle, $jsonString);
fclose($handle);
if ($fwrite) {
    echo 'Done. Check ' . realpath($fileName) . ' file.';
} else {
    echo 'Failed to write ' . realpath($fileName) . ' to disk.';
}
开发者ID:juanmnl07,项目名称:treetopstravel_test,代码行数:31,代码来源:exportToJSON.php


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