To get the system uptime in PHP, you can use the exec()
function to execute the uptime
command and retrieve the output. Here's an example code block that shows how to do it:
main.php123 chars8 lines
When you run this code, you'll see the system uptime displayed in the format 10:23 up 23 days, 23:45, 1 user, load average: 0.89, 1.05, 1.02
. The uptime value will be located after the up
keyword.
gistlibby LogSnag