<?PHP
$exec = shell_exec('uptime');
$uptime = explode(' up ',$exec);
$uptime = explode(',',$uptime[1]);
if (strpos($uptime[0],'day')) {
$time = explode(':',$uptime[1]);
echo('Current system uptime is ' . $uptime[0]. ',' . $time[0] . ' hours,' . $time[1] . ' minutes');
} elseif (strpos($uptime[0],':')) {
$time = explode(':',$uptime[0]);
echo('Current system uptime is ' . $time[0] . ' hours,' . $time[1] . ' minutes');
} else {
$time = explode(' ',$uptime[0]);
echo('Current system uptime is ' . $time[0] . ' minutes');
}
?>
@H_502_8@
以上是编程之家(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。
如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。