新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
使用php怎么求相對時間-創(chuàng)新互聯(lián)
本篇文章為大家展示了使用php怎么求相對時間,內(nèi)容簡明扼要并且容易理解,絕對能使你眼前一亮,通過這篇文章的詳細介紹希望你能有所收獲。
具體實現(xiàn)方法如下:
$now) $relative = 'in the future'; else { $diff = $now - $time; if ($diff >= $limit) $relative = date($format, $time); elseif ($diff < 60) { $relative = 'less than one minute ago'; } elseif (($minutes = ceil($diff / 60)) < 60) { $relative = $minutes . ' minute' . (((int)$minutes === 1) ? '' : 's') . ' ago'; } else { $hours = ceil($diff / 3600); $relative = 'about ' . $hours . ' hour' . (((int)$hours === 1) ? '' : 's') . ' ago'; } } return $relative; }
上述內(nèi)容就是使用php怎么求相對時間,你們學到知識或技能了嗎?如果還想學到更多技能或者豐富自己的知識儲備,歡迎關注創(chuàng)新互聯(lián)行業(yè)資訊頻道。
網(wǎng)頁題目:使用php怎么求相對時間-創(chuàng)新互聯(lián)
鏈接URL:http://fisionsoft.com.cn/article/djcdip.html