這看起來更加人性化,好吧,上代碼 復制代碼 代碼如下: <?php class timeAgo { static $timeagoObject; private $rustle; private $unit;

private function __construct() {

} private function __clone(){ " /> 1788福利视频在视频线,70岁妇女牲交色牲片,我的奶头被客人吸的又肿又红

天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

php中將時間差轉(zhuǎn)換為字符串提示的實現(xiàn)代碼

如微博

這看起來更加人性化,好吧,上代碼
復制代碼 代碼如下:
<?php
class timeAgo
{
static $timeagoObject;
private $rustle;
private $unit;

private function __construct()
{

}
private function __clone(){ }
public static function getObject()
{
if(! (self::$timeagoObject instanceof self) )
self::$timeagoObject = new timeAgo();

return self::$timeagoObject;
}
private function count_int($unix_C) // main function
{
if(! (isset($unix_C) || is_numeric($unix_C)) )
return 'don/'t find parameter';

$d = time()-$unix_C ; // $d - unix time difference value
$d_int =(int)floor($d/60) ; // minimum unit -- minutes unix/60

$this->unit = 0 ; // is minutes,hour or day?

if($d_int < 60){ // minutes in one hour 3600
$this->rustle = $d_int;
$this->unit = 1;
}
else if($d_int < 720){ //hour in one day 3600*12
$this->rustle = floor($d_int/60);
$this->unit = 2 ;
}
else if($d_int < 7200){ //day in ten days 3600*12*10
$this->rustle = floor($d_int/720);
$this->unit = 3 ;
}
else{
$this->rustle = $d ;
$this->unit = 4 ;
}
}
public function piece_str($C)
{
$this->count_int($C);

$u = '';
switch( $this->unit )
{
case 1:
$u = 'minute';
break;
case 2:
$u = 'hour';
break;
case 3:
$u = 'day';
break;
case 4:
$u = '';
break;
case 0:
return 'sorry , get time is fail';
}
if($this->unit < 4)
{
if($this->rustle > 1)
return (string)$this->rustle.$u.'s ago';
else if($this->rustle == 1)
return (string)$this->rustle.$u.'ago';
else
return 'Just now';
}
}
/* example: $ago = timeAgo::getObject();
* echo $ago->piece_str($unix);
* // 2 days ago
*/
}
?>

php技術(shù)php中將時間差轉(zhuǎn)換為字符串提示的實現(xiàn)代碼,轉(zhuǎn)載需保留來源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: www色小姐 | 好想被狂躁A片免费久99 | 伊人情涩网 | 亚洲国产中文字幕在线视频 | 99在线观看免费 | 国产人妻久久久精品麻豆 | 日日AV夜夜添久久奶无码 | 国产69精品久久久熟女 | 国产露脸无码A区久久 | 欧美高清vivoesond在线播放 | 性欧美video 性欧美sexovideotv | 欧美阿v天堂视频在99线 | aaaaaaa一级毛片 | 国产欧美日韩综合精品一区二区 | 日本精品久久久久中文字幕 1 | 日本撒尿特写 | 国产骚妇BB网 | 久久精品影院永久网址 | china18一19 第一次 | 国产欧洲野花A级 | 一起洗澡的老师免费播放 | 艳鉧动漫片1~6全集在线 | 国产精品爽爽久久久久久蜜桃 | 国产人妻人伦精品1国产 | 国产午夜精品久久理论片 | 国产白丝JK被疯狂输出视频 | 天天看高清影视在线18 | 三级黄毛片 | 午夜无码国产理论在线 | 日本精品久久久久中文字幕 | 边做边爱BD免费看片 | 少爷不要别揉了高H | 麻豆AV福利AV久久AV | 99精品免费在线观看 | 国产精品久久久久久免费播放 | 国产精品成人在线播放 | 久久伊人影院 | 亚洲国产中文字幕在线视频 | 久久精品WWW人人爽人人 | 狠狠操伊人 | 精品国产免费观看久久久 |