php - CodeIgniter 移动操作系统检测

标签 php codeigniter

我已经能够通过 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/

相关文章:

php - 文件上传到目的地但名称未保存在 codeigniter 中的数据库中

javascript - 当用户单击 JavaScript 警报上的确定按钮时更新表

php - 调用非对象上的成员函数bind_param()

php - CodeIgniter MySQL 查询使用过多内存 - 如何使用 MySQL 的 SSCursor?

php - 当值有引号时,列值的字符串长度减一

.htaccess 文件不适用于主页

php - 无法使用 Facebook OAuth 获取访问 token

php - 如何根据值显示多个表格

javascript - 基于某些变量的 Bootstrap 上下文表

javascript - 如果条件在引导弹出窗口中不起作用