<table cellspacing="0" cellpadding="0"><tr><td class="t_f" id="postmessage_59134"> <div class="blockcode"> <div id="code_i61"><ol> <li><?php <li>class runtime<li>{ <li> var $StartTime = 0; <li> var $StopTime = 0; <li><li> function get_microtime() <li> { <li> list($usec, $sec) = explode(' ', microtime()); <li> return ((float)$usec (float)$sec); <li> } <li><li> function start() <li> { <li> $this->StartTime = $this->get_microtime(); </li> <li> } </li> <li> <li> function stop() </li> <li> { </li> <li> $this->StopTime = $this->get_microtime(); </li> <li> } </li> <li> <li> function spent() </li> <li> { </li> <li> return round(($this->StopTime - $this->StartTime) * 1000, 1); </li> <li> } </li> <li> <li>}</li> <li> <li>//例子 </li> <li>$runtime= new runtime;</li> <li>$runtime->start();</li> <li> <li>//你的代码开始</li> <li> <li>$a = 0;</li> <li>for($i=0; $i<1000000; $i )<li>{<li> $a = $i;<li>}<li><li>//你的代码结束<li><li>$runtime->stop();</li> <li>echo "页面执行时间: ".$runtime->spent()." 毫秒";</li> <li>?></li> </ol></div> <em onclick="copycode($('code_i61'));">复制代码</em> </div> <br> </td></tr></table> <div class="ptg mbm mtn"> 실행 시간, PHP</div> <div id="comment_59134" class="cm"> </div> <div id="post_rate_div_59134"></div> <br><br>