소스 검색

验证内容字数

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字',