瀏覽代碼

验证内容字数

wzq 5 年之前
父節點
當前提交
54136888b7
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      app/Repositories/Post/PostRepository.php

+ 1 - 1
app/Repositories/Post/PostRepository.php

@@ -79,7 +79,7 @@ class PostRepository
         $topicIds = implode(',', $topicIdsArray);
 
         //验证内容字数
-        $html = preg_replace("/<([a-zA-Z]+)[^>]*>/","<\\1>",$request['content']);
+        $html = strip_tags($request['content']);
         if(mb_strlen($html,'UTF8') > 1000){
             return Response::create([
                 'message'  => '所传内容不能超过1000字',