函数文档

timer_start()

💡 云策文档标注

概述

timer_start() 是 WordPress 核心函数,用于启动微秒级计时器,通过设置全局变量 $timestart 记录当前时间戳。

关键要点

  • 函数 timer_start() 启动 WordPress 微计时器,设置全局变量 $timestart 为 microtime(true) 的返回值。
  • 返回值始终为 true,表示计时器已成功启动。
  • 该函数自 WordPress 0.71 版本引入,是性能测量和调试的基础工具。

代码示例

function timer_start() {
    global $timestart;

    $timestart = microtime( true );

    return true;
}

📄 原文内容

Starts the WordPress micro-timer.

Description

See also

Return

bool Always returns true.

Source

function timer_start() {
	global $timestart;

	$timestart = microtime( true );

	return true;
}

Changelog

Version Description
0.71 Introduced.