function ago($timestamp){
$difference = time() - $timestamp;
$text = format_interval($difference, 2) . " 前";
return $text;
}
=--------------------------调用-----------
ago($test->node_created) 例;1小时30分钟前 2表示显示的位数,如果是3 ,则还要现实秒数 最重要的函数是foramt_interval()
转载于:https://www.cnblogs.com/pigg/archive/2009/09/04/1560482.html