Benchmarking PHP page load times

前端 未结 10 2064
借酒劲吻你
借酒劲吻你 2021-01-31 10:56

How could I measure the time taken to load a page (with various different PHP statements)?

Somewhat like the stats available here - http://talks.php.net/show/drupal08/24

10条回答
  •  说谎
    说谎 (楼主)
    2021-01-31 11:37

    You can use microtime() at the start of processing and at end of output, then calculate the difference and convert it to seconds if wanted.

    This will only measure the execution time for PHP side, not the whole page load time at it seems to be in your link, but it will able you to compare various methods performance, for instance.

提交回复
热议问题