我已经能够通过 CodeIgniter 检测用户使用的移动设备,但无法检测当前移动设备运行的操作系统。
假设某人正在使用在 Android 上运行的三星移动设备,而另一人正在使用仍然是三星的普通 Java 移动操作系统。如何查看每个用户使用的是哪个操作系统?
最佳答案
从 http://mobiledetect.net 下载库 将 Mobile_Detect.php 放入“库”
在主 Controller 内部
public function index() {
$this -> load -> library('Mobile_Detect');
$detect = new Mobile_Detect();
if ($detect->isMobile() || $detect->isTablet() || $detect->isAndroidOS()) {
header("Location: ".$this->config->item('base_url')."/mobile"); exit;
}
}
在 https://dwij.net/mobile-os-detection-in-php-codeigniter/ 上查找文档
关于php - CodeIgniter 移动操作系统检测,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16859864/