1// 代码使用 nesbot/carbon 包 2 3// get last bootup time 4exec('WMIC OS GET LastBootUpTime', $output); 5 6$bootUpTime = current(explode('+', $output[1])); 7$bootUpTime = Carbon::createFromFormat('YmdHis.u', $bootUpTime)->timestamp; 8 9$bootedSeconds = Carbon::now()->timestamp - $bootUpTime; 10 11echo "系统已运行:{$bootedSeconds} 秒";
PHP 取 Windows 启动时间及计算已启动秒数

MaxSky
2021-04-19
2200 0 0
点赞
收藏
评论区
加载中...