<?php ////////////////////////////// // get the program run time // ////////////////////////////// // example $runTime = new \runTime(); $runTime->start(); // do some thing sleep(1); $runTime->stop(); echo 'spent:', $runTime->spent(); class runTime { private $starTime; private $stopTime; private function getMicTime() { $mictime = microtime(); list($usec, $sec) = explode(' ', $mictime); return (double) $usec + (double) $sec; } public function start() { $this->starTime = $this->getMicTime(); } public function stop() { $this->stopTime = $this->getMicTime(); } public function spent()
<!DOCTYPE html> <?php date_default_timezone_set('PRC'); require_once "Core/runTime.class.php"; require_once "Core/File.class.php"; $run = new runTime(); $run->start(); $fileInfo = new File(); ?> <html lang="en"> <head> <meta charset="UTF-8"> <title><?php echo $fileInfo->info['current']; ?> </title> <link rel="stylesheet" href="Assets/css/reset.css"> <link rel="stylesheet" href="Assets/css/style.css"> <script src="Assets/js/function.js"></script> </head> <body onload="bodyLoad()"> <div class="h-s"></div> <div class="content"> <div class="row-1"> <div class="left"> <?php echo $fileInfo->info['current']; ?> </div> <div class="right"> <span id="date"> </span> <span id="time"></span>