xielin 5 år sedan
förälder
incheckning
d7f36dbacb
1 ändrade filer med 4 tillägg och 0 borttagningar
  1. 4 0
      app/Helper/helper.php

+ 4 - 0
app/Helper/helper.php

@@ -135,7 +135,11 @@ function jsonError($msg, $data = [])
 
 function subtext($text, $length)
 {
+    //去除标签  空格 换行等空白字符
     $text = strip_tags($text);
+    $search = array(" ", " ", "\n", "\r", "\t");
+    $replace = array("", "", "", "", "");
+    $text = str_replace($search, $replace, $text);
     if (mb_strlen($text, 'utf8') > $length) {
         return mb_substr($text, 0, $length - 1, 'utf8') . '...';
     } else {