這看起來更加人性化,好吧,上代碼 復制代碼 代碼如下: <?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)系我們修改或刪除,多謝。

主站蜘蛛池模板: 久久婷婷色香五月综合激情 | 中文视频在线观看 | 乌克兰18性hd | 国产精品青青青高清在线密亚 | 国产视频精品在线偷拍 | 亚洲国产韩国欧美在线不卡 | 成年妇女免费播放 | 精品人妻伦一二三区久久AAA片 | 在线 | 果冻国产传媒61国产免费 | 日本综艺大尺度无删减版在线 | 伊人免费在线 | 日本无码毛片久久久九色综合 | 蜜臀AV99无码精品国产专区 | 美女扒开尿口直播 | 久久久久久久伊人电影 | 日本电影护士 | 亚洲国产精品日本无码网站 | 芳草地在线观看免费视频 | 亚洲一区在线视频观看 | 神电影院午夜dy888我不卡 | 精品香蕉99久久久久网站 | 国产亚洲福利在线视频 | 久久综合久久伊人 | 精品国产在线国语视频 | 婷婷色色狠狠爱 | 久久精品国产亚洲AV未满十八 | 果冻传媒在线观看网站 | 色影音先锋av资源网 | 欧美日韩黄色 | caoporn 免费视频 | 人妻夜夜爽99麻豆AV | 日本三区四区免费高清不卡 | 午夜伦理:伦理片 | 黑人寄宿羽月希产后奶水 | 第一怡春院 | 福利片福利一区二区三区 | 中文字幕 亚洲 有码 在线 | 麻豆区蜜芽区 | 无码人妻精品一区二区蜜桃色 | 国产精一品亚洲二区在线播放 | 伊人久久综合成人亚洲 |