本文整理汇总了PHP中PHP_Timer::requestTime方法的典型用法代码示例。如果您正苦于以下问题:PHP PHP_Timer::requestTime方法的具体用法?PHP PHP_Timer::requestTime怎么用?PHP PHP_Timer::requestTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHP_Timer
的用法示例。
在下文中一共展示了PHP_Timer::requestTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: timeSinceStartOfRequest
return $time . ' ' . ($time == 1 ? $unit : $unit . 's');
}
}
return $ms . ' ms';
}
/**
* Formats the elapsed time since the start of the request as a string.
*
* @return string
*/
public static function timeSinceStartOfRequest()
{
return self::secondsToTimeString(microtime(true) - self::$requestTime);
}
/**
* Returns the resources (time, memory) of the request as a string.
*
* @return string
*/
public static function resourceUsage()
{
return sprintf('Time: %s, Memory: %4.2fMb', self::timeSinceStartOfRequest(), memory_get_peak_usage(true) / 1048576);
}
}
if (isset($_SERVER['REQUEST_TIME_FLOAT'])) {
PHP_Timer::$requestTime = $_SERVER['REQUEST_TIME_FLOAT'];
} elseif (isset($_SERVER['REQUEST_TIME'])) {
PHP_Timer::$requestTime = $_SERVER['REQUEST_TIME'];
} else {
PHP_Timer::$requestTime = microtime(true);
}
示例2: timeSinceStartOfRequest
if ($ms >= $value) {
$time = floor($ms / $value * 100.0) / 100.0;
return $time . ' ' . ($time == 1 ? $unit : $unit . 's');
}
}
return $ms . ' ms';
}
/**
* Formats the elapsed time since the start of the request as a string.
*
* @return string
*/
public static function timeSinceStartOfRequest()
{
return self::secondsToTimeString(microtime(TRUE) - self::$requestTime);
}
/**
* Returns the resources (time, memory) of the request as a string.
*
* @return string
*/
public static function resourceUsage()
{
return sprintf('Time: %s, Memory: %4.2fMb', self::timeSinceStartOfRequest(), memory_get_peak_usage(TRUE) / 1048576);
}
}
if (isset($_SERVER['REQUEST_TIME_FLOAT'])) {
PHP_Timer::$requestTime = $_SERVER['REQUEST_TIME_FLOAT'];
} else {
PHP_Timer::$requestTime = microtime(TRUE);
}
示例3: timeSinceStartOfRequest
}
return $buffer;
}
/**
* Formats the elapsed time since the start of the request as a string.
*
* @return string
*/
public static function timeSinceStartOfRequest()
{
return self::secondsToTimeString(time() - self::$requestTime);
}
/**
* Returns the resources (time, memory) of the request as a string.
*
* @return string
*/
public static function resourceUsage()
{
return sprintf('Time: %s, Memory: %4.2fMb', self::timeSinceStartOfRequest(), memory_get_peak_usage(TRUE) / 1048576);
}
}
if (isset($_SERVER['REQUEST_TIME_FLOAT'])) {
PHP_Timer::$requestTime = $_SERVER['REQUEST_TIME_FLOAT'];
} else {
if (isset($_SERVER['REQUEST_TIME'])) {
PHP_Timer::$requestTime = $_SERVER['REQUEST_TIME'];
} else {
PHP_Timer::$requestTime = time();
}
}