本文整理匯總了PHP中Time::time方法的典型用法代碼示例。如果您正苦於以下問題:PHP Time::time方法的具體用法?PHP Time::time怎麽用?PHP Time::time使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Time
的用法示例。
在下文中一共展示了Time::time方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: sqlTime
public static function sqlTime($timestamp = null)
{
if ($timestamp !== null && !is_numeric($timestamp)) {
$timestamp = Time::time($timestamp);
}
return $timestamp ? date('H:i:s', $timestamp) : date('H:i:s');
}
示例2: time
/**
* To return the time either artificial or correct.
* @param boolean $realTime
* @return int
*/
function time($mode = "CURR", $givenTime = 0)
{
if (strtoupper($mode) == "CURR") {
//If mode is "CURR", return the correct user specified time.
return Time::time();
} elseif (strtoupper($mode) == "SET") {
//If mode is "SET", set the current time as specified by user.
return Time::setTime($givenTime);
} elseif (strtoupper($mode) == "RESET") {
//If mode is "RESET", reset the time to the correct system time.
return Time::resetTime();
} elseif (strtoupper($mode) == "MOV") {
//If mode is "MOV", move the clock backward to the difference in time specified by the user. E.g. to move time backward 10 seconds, you will write phpsec\time("MOV", 10);
return Time::moveTime($givenTime);
} elseif (strtoupper($mode) == "SYS") {
//If mode is "SYS", return the correct system time.
return \time();
} else {
return 0;
}
//If none of the mode matches, return 0.
}
示例3: set
public static function set($time)
{
self::$time = $time;
}
示例4: generate
public function generate($time = null)
{
return $this->prefix . date('Ymd:Hi:', $time ?: Time::time()) . uniqid(getmypid(), true);
}