From b91e3e84b2ce5083c599128331b96bd4e972d558 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=93=87=E5=91=9C=E5=93=87=E5=91=9C=E5=91=80=E5=92=A6?= =?UTF-8?q?=E8=80=B6?= Date: Wed, 20 Sep 2023 17:51:53 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8D64=E4=BD=8D=E7=B3=BB=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- device.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/device.php b/device.php index 3c7180d..00e9d62 100644 --- a/device.php +++ b/device.php @@ -42,6 +42,21 @@ if (($str = @file("/proc/cpuinfo")) !== false){ else{ $D['cpu']['model'] = $model[1][0].$bogomips[1][0].' ×'.$D['cpu']['count']; } + } else { + if (($str = @shell_exec("lscpu")) !== false){ + $str = implode("", $str); + @preg_match_all("/Model\s+name\s{0,}\:+\s{0,}([\w\s\)\(\@.-]+)([\r\n]+)/s", $str, $model); + @preg_match_all("/CPU\(s\)\s{0,}\:+\s{0,}(\d+)([\r\n]+)/s", $str, $cpucnt); + if (false !== is_array($model[1])) { + $D['cpu']['count'] = $cpucnt[1][0]; + if($D['cpu']['count'] == 1){ + $D['cpu']['model'] = $model[1][0].$bogomips[1][0]; + } + else{ + $D['cpu']['model'] = $model[1][0].$bogomips[1][0].' ×'.$D['cpu']['count']; + } + } + } } if (false !== is_array($pimodel[1])){ @@ -180,4 +195,4 @@ function get_info(){ $D['net']['count'] = 0; } } -?> \ No newline at end of file +?>