本文整理汇总了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);
}