ezze / yii2-mobile-detect
该包最新版本(0.1.0)没有可用的许可证信息。
用于检测移动设备的Yii2组件
0.1.0
2015-04-08 20:59 UTC
Requires
- mobiledetect/mobiledetectlib: 2.8.*
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2024-09-20 20:46:46 UTC
README
本扩展提供了对Mobile_Detect PHP类的Yii2组件包装,可用于在Yii2应用程序中检测设备是否为移动设备。
安装
安装此扩展的首选方式是通过Composer。
运行以下命令之一:
php composer.phar require --prefer-dist ezze/yii2-mobile-detect
或者在您的composer.json
文件的require
部分添加以下内容:
"ezze/yii2-mobile-detect": "~0.1.0"
使用方法
-
将
mobileDetect
组件添加到您的Yii2配置中,如下所示'components' => [ 'mobileDetect' => [ 'class' => '\ezze\yii2\mobiledetect\MobileDetect' ] ]
-
将
mobileDetect
组件用作Mobile_Detect PHP类echo \Yii::$app->mobileDetect->isMobile();