Explorar o código

通用方法改进

lizhen_gitee hai 1 ano
pai
achega
6ef76f672e
Modificáronse 1 ficheiros con 4 adicións e 3 borrados
  1. 4 3
      application/common.php

+ 4 - 3
application/common.php

@@ -517,9 +517,10 @@ function request_post_hub($field_array = [],$required = [],$noempty = []){
  */
  */
 function get_last_time($time = NULL) {
 function get_last_time($time = NULL) {
     $text = '';
     $text = '';
-    $time = $time === NULL || $time > time() ? time() : intval($time);
-    $t = time() - $time; //时间差 (秒)
-    $y = date('Y', $time)-date('Y', time());//是否跨年
+    $nowtime = time();
+    $time = ($time === NULL || empty($time) || $time > $nowtime) ? $nowtime : intval($time);
+    $t = $nowtime - $time; //时间差 (秒)
+    $y = date('Y', $time)-date('Y', $nowtime);//是否跨年
     switch($t){
     switch($t){
         case $t == 0:
         case $t == 0:
             $text = '刚刚';
             $text = '刚刚';