Browse Source

验证内容字数

wzq 5 years ago
parent
commit
54136888b7
1 changed files with 1 additions and 1 deletions
  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字',