适配64位系统

pull/32/head
哇呜哇呜呀咦耶 2023-09-20 17:51:53 +08:00 committed by GitHub
parent da67d4c20d
commit b91e3e84b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 1 deletions

View File

@ -42,6 +42,21 @@ if (($str = @file("/proc/cpuinfo")) !== false){
else{ else{
$D['cpu']['model'] = $model[1][0].$bogomips[1][0].' ×'.$D['cpu']['count']; $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])){ if (false !== is_array($pimodel[1])){