如果您想在高效环境中测量速度,我只需手动测量. microtime()
是PHP中这些功能的功能.假设你有一个header.PHP和一个footer.PHP,它被所有PHP脚本调用:
# In your header.PHP (or tpl) $GLOBALS['_execution_start'] = microtime(true); # In your footer.PHP (or tpl) file_put_contents( '/tmp/my_profiling_results.txt',microtime(true) - $GLOBALS['_execution_start'] . ':' . print_r($_SERVER,true) . "\n",FILE_APPEND );