首页 > php代码 > php 显示文章 几分钟 几小时 几天前

php 显示文章 几分钟 几小时 几天前

php教程 显示文章 几分钟 几小时 几天前

 $time = time() - $time;
        if ($time <= 24 * 3600) {
            if ($time > 3600) {
                $timestring = intval($time / 3600) . '小时前';
            } elseif ($time > 60) {
                $timestring = intval($time / 60) . '分钟前';
            } elseif ($time > 0) {
                $timestring = $time . '秒前';
            } else {
                $timestring = '现在前';
            }
        }

永久链接:http://www.phprm.com/code/39804.html

转载随意!带上文章地址吧。

标签:none

发表留言