您可以microtime(true)通过以下方式使用:将其放在您的php文件的开头://place this before any script you want to calculate time$time_start = microtime(true);//您的脚本代码在这里// do something把它放在你的php文件的末尾:// Display Script End time$time_end = microtime(true);//dividing with 60 will give the execution time in minutes other wise seconds$execution_time = ($time_end - $time_start)/60;//execution time of the scriptecho '<b>Total Execution Time:</b> '.$execution_time.' Mins';它将输出结果minutes。