larapack/mobiledetect

此包最新版本(1.0)没有可用的许可证信息。

Laravel MobileDetect 扩展包

1.0 2015-06-10 11:16 UTC

This package is auto-updated.

Last update: 2024-09-06 09:49:46 UTC


README

Build Status Total Downloads Latest Stable Version Latest Unstable Version License

信息

版本:1.0
作者:Mark Topper [Facebook] [Github] [Twitter]
网站: www.webman.io
电子邮件: mark@webman.io

安装

首先,通过运行命令 composer require larapack/mobiledetect 1.* 或将以下代码添加到 composer.json 中,然后运行命令 composer update 将包添加到您的composer中。

{
    "require": {
        "larapack/mobiledetect": "1.*"
    }
}

在您的 app/config/app.php 中的别名中添加别名。

'aliases' => array(
    // ...
    'MobileDetect' => 'Larapack\MobileDetect\MobileDetect',
)

用法

以下示例假设您使用 MobileDetect 类名作为别名,但包是命名空间的,因此您可以按需命名外观。

$detect = MobileDetect;

if ($detect->isMobile()){
  // this is a mobile
}
else if ($detect->isTablet()){
  // this is a tablet
}

if ($detect->isIE()){
  // this is IE -.-'
}

更多示例请访问 http://mobiledetect.net/