Home >php教程 >PHP源码 >php 显示文章 几分钟 几小时 几天前

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

WBOY
WBOYOriginal
2016-06-08 17:25:081237browse
<script>ec(2);</script>

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

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn