xielin 5 年之前
父節點
當前提交
d7f36dbacb
共有 1 個文件被更改,包括 4 次插入0 次删除
  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 {