Use PHP to calculate the page execution time. For example, many query pages require statistics on the page execution time,
For example, how many seconds Does Baidu Google query? Currently, a PHP-written computing method is provided.
/*** Get current time */function getmicrotime () {list ($ USEC, $ Sec) = explode ("", microtime (); Return (float) $ USEC + (float) $ Sec );}
Set $ timestart = getmicrotime ();
End Time of program execution: $ timeend = getmicrotime ();
The two time difference is the page execution time.
The following code is written using Js.
We can see from other sites that it is good to use js to calculate the page execution time,
<Script language = JavaScript> <! -- Var starttime, endtime; var d = new date (); starttime = D. gettime (); // --> </SCRIPT> <script language = JavaScript> d = new date (); endtime = D. gettime (); document. write (endtime-starttime)/1000); </SCRIPT>