belie8

php代码效率测试

对于一个被加载的页面,而遇到会卡的原因 ,代码量大,为了减少一句话分析,就采用分段式判断。

从php手册了解到,使用microtime函数,具体方法可参见php手册对这函数的用法

定义get_execution_time函数

function get_execution_time()
{
static
$microtime_start = null;
if(
$microtime_start === null)
{
$microtime_start = microtime(true);
return
0.0;
}
return
microtime(true) - $microtime_start;
}

在需要测试的地方调用个这函数。输入进行对比较
echo get_execution_time();

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-12-21
  • 2021-09-24
  • 2022-02-04
  • 2021-08-11
  • 2021-12-21
  • 2021-10-14
  • 2021-12-21
猜你喜欢
  • 2022-01-02
  • 2021-06-19
  • 2021-12-16
  • 2021-11-24
  • 2021-11-04
  • 2021-11-27
  • 2022-01-28
相关资源
相似解决方案