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

private function __construct() {

} private function __clone(){ " /> 黄色jjzz,蕾丝边娱乐网,熟妇无码乱子成人精品

天天躁日日躁狠狠躁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中將時間差轉換為字符串提示的實現代碼,轉載需保留來源!

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

主站蜘蛛池模板: 黄页网址大全免费观看 | 国产精品1卡二卡三卡四卡乱码 | 国产毛A片啊久久久久久A | 真实伦 乱 | 久久re这里视频只精品首页 | 无码人妻视频又大又粗欧美 | 久久亚洲国产中文字幕 | 国产1769一七六九视频在线 | 一一本之道高清视频在线观看中文字幕 | 一个人看www| 成年人视频在线免费看 | 无限资源好看片2019免费观看 | 亚洲.欧美.中文字幕在线观看 | 精品96在线观看影院 | cctv论坛| 精品国产在天天线在线麻豆 | avove旗袍丝袜高跟啪啪 | 亚洲精品国产自在在线观看 | 美女夫妻内射潮视频 | 国产99精品视频一区二区三区 | a久久99精品久久久久久蜜芽 | 久久精品观看 | 欧美中文字幕一区二区三区 | 99热都是精品 | 97在线免费观看 | 亚洲精品天堂自在久久77 | 混乱家庭电影完整版在线看 | 狼人无码伊人AV啪啪 | 欧美中文字幕一区二区三区 | 青青草原在线免费 | 亚洲欧美色综合影院 | 成人国产精品日本在线 | 日本毛片久久国产精品 | 美丽的姑娘BD在线观看 | 在线亚洲精品国产一区麻豆 | 男女又黄又刺激B片免费网站 | 国产a视频视卡在线 | 免费看午夜高清性色生活片 | 中国女人内谢69xxxxxx直播 | 一级做a爰片久久毛片苍井优 | 韩国精品无码少妇在线观看网站 |