Pārlūkot izejas kodu

验证内容字数

wzq 5 gadi atpakaļ
vecāks
revīzija
54136888b7
1 mainītis faili ar 1 papildinājumiem un 1 dzēšanām
  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字',