|
@@ -398,4 +398,34 @@ if(!function_exists('array_sort')) { |
|
@@ -398,4 +398,34 @@ if(!function_exists('array_sort')) { |
398
|
}
|
398
|
}
|
399
|
return $array;
|
399
|
return $array;
|
400
|
}
|
400
|
}
|
|
|
401
|
+}
|
|
|
402
|
+
|
|
|
403
|
+if(!function_exists('tranTime')) {
|
|
|
404
|
+ function tranTime($time)
|
|
|
405
|
+ {
|
|
|
406
|
+ $rtime = date("m-d H:i", $time);
|
|
|
407
|
+ $htime = date("H:i", $time);
|
|
|
408
|
+ $time = time() - $time;
|
|
|
409
|
+ if ($time < 60) {
|
|
|
410
|
+ $str = '刚刚';
|
|
|
411
|
+ } elseif ($time < 60 * 60) {
|
|
|
412
|
+ $min = floor($time / 60);
|
|
|
413
|
+ $str = $min . '分钟前';
|
|
|
414
|
+ } elseif ($time < 60 * 60 * 24) {
|
|
|
415
|
+ $h = floor($time / (60 * 60));
|
|
|
416
|
+ $str = $h . '小时前 ' . $htime;
|
|
|
417
|
+ } else {
|
|
|
418
|
+ $str = floor($time / 86400) . '天前';
|
|
|
419
|
+ }
|
|
|
420
|
+// elseif ($time < 60 * 60 * 24 * 3) {
|
|
|
421
|
+// $d = floor($time / (60 * 60 * 24));
|
|
|
422
|
+// if ($d == 1)
|
|
|
423
|
+// $str = '昨天 ' . $rtime;
|
|
|
424
|
+// else
|
|
|
425
|
+// $str = '前天 ' . $rtime;
|
|
|
426
|
+// } else {
|
|
|
427
|
+// $str = $rtime;
|
|
|
428
|
+// }
|
|
|
429
|
+ return $str;
|
|
|
430
|
+ }
|
401
|
} |
431
|
} |