需要php允许执行shell_exec函数,代码如下:
<?php $totalMemory = round(shell_exec('cat /proc/meminfo | grep MemTotal | awk \'{print $2}\'') / 1024 / 1024 / 1024, 2); echo $totalMemory . " GB"; echo "CPU Cores: " . trim(shell_exec("nproc")) . "\n"; ?>
网友回复
需要php允许执行shell_exec函数,代码如下:
<?php $totalMemory = round(shell_exec('cat /proc/meminfo | grep MemTotal | awk \'{print $2}\'') / 1024 / 1024 / 1024, 2); echo $totalMemory . " GB"; echo "CPU Cores: " . trim(shell_exec("nproc")) . "\n"; ?>
网友回复