日志记录辅助函数测试
This commit is contained in:
@@ -40,6 +40,7 @@ if (!function_exists('get_device_type')) {
|
||||
'isTablet' => false,
|
||||
'deviceType' => 'Desktop',
|
||||
'browser' => '',
|
||||
'platform' => ''
|
||||
];
|
||||
|
||||
// 检查是否为移动设备
|
||||
@@ -68,7 +69,9 @@ if (!function_exists('get_device_type')) {
|
||||
}
|
||||
|
||||
// 确定操作系统平台
|
||||
if (strpos($userAgent, 'Windows NT 10.0') !== false) {
|
||||
if (strpos($userAgent, 'Windows NT 10.0; Win64; x64') !== false && strpos($userAgent, 'WOW64') === false) {
|
||||
$deviceInfo['platform'] = 'Windows 11';
|
||||
} elseif (strpos($userAgent, 'Windows NT 10.0') !== false) {
|
||||
$deviceInfo['platform'] = 'Windows 10';
|
||||
} elseif (strpos($userAgent, 'Windows NT 6.3') !== false) {
|
||||
$deviceInfo['platform'] = 'Windows 8.1';
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', true);
|
||||
defined('YII_ENV') or define('YII_ENV', 'dev');
|
||||
|
||||
require __DIR__. '/../helpers/helpers.php';
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
require __DIR__ . '/../vendor/yiisoft/yii2/Yii.php';
|
||||
require __DIR__ . '/../common/config/bootstrap.php';
|
||||
@@ -15,4 +16,7 @@ $config = yii\helpers\ArrayHelper::merge(
|
||||
require __DIR__ . '/../admin/config/main-local.php'
|
||||
);
|
||||
|
||||
if ($_GET['test']?? '' === 'liqi') {
|
||||
print_r(get_device_type());die;
|
||||
}
|
||||
(new \common\core\WebApplication($config))->run();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', true);
|
||||
defined('YII_ENV') or define('YII_ENV', 'dev');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user