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

php將時間差轉換為字符串提示

這看起來更加人性化,好吧,上代碼
復制代碼 代碼如下:
<?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技術php將時間差轉換為字符串提示,轉載需保留來源!

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

主站蜘蛛池模板: 校园女教师之禁区 | 日韩插啊免费视频在线观看 | 国产欧美无码亚洲 | 丰满五十老女人性视频 | 国产91专区 | 国内精品久久久久久久999下 | 久久免费看少妇高潮A片JA | 最近中文字幕2018MV高清在线 | 少妇高潮A片特黄久久精品网 | 年轻的女职工在线观看 | 性欧美video另类hd高清 | 国内精品自线在拍2020不卡 | 99re6久久热在线视频 | 伊人久久大香 | 涩涩免费网站 | 日韩中文亚洲欧美视频二 | 男人和女人全黄一级毛片 | 神电影院午夜dy888我不卡 | 2020亚洲国产在线播放在线 | 调教美丽的白丝袜麻麻视频 | 国产精品久久久久久人妻精品蜜桃 | 毛片免费观看的视频 | 欧美丰满少妇久久无码精品 | 久久久亚洲国产精品主播 | 抽插内射高潮呻吟爆乳 | 白百合在线观看 | 日本亚欧热亚洲乱色视频 | 99视频国产在线 | 91国偷自产一区二区三区 | 亚洲AV久久无码精品国产网站 | 暖暖视频在线高清播放 | 亚洲 色 欧美 爱 视频 日韩 | 大香伊蕉在人线国产97 | 青草影院内射中出高潮-百度 | 国产精品成人免费观看 | 日本又黄又裸一级大黄裸片 | 思思99精品国产自在现线 | 啪啪激情婷婷久久婷婷色五月 | 亚洲色大成网站WWW永久麻豆 | 国产亚洲人成在线视频 | 欧美性受xxxx狂喷水 |