php過濾html標籤、特殊字元、轉義字元

helong3314發表於2021-12-25
function search_fill($content){

$html_string =  htmlspecialchars_decode($content);

$html_string =  str_replace("  ",  "",  $html_string);

$html_string =  str_replace("'",  "",  $html_string);

$html_string =  str_replace("“",  "",  $html_string);

$html_string =  str_replace("”",  "",  $html_string);

$html_string =  str_replace("‘",  "",  $html_string);

$html_string =  str_replace("’",  "",  $html_string);

$html_string =  str_replace("\"",  "",  $html_string);

$html_string =  strip_tags($html_string);

        $arr=array(

 " ",

 " ",

 " ",

 " ",

 "‌",

 "‍",

 "“",

 "”",

 """,

 "´",

 "¨",

 "insert",

 "into",

 "delete",

 "add",

 "select"

        );

$html_string =  str_replace($arr,  "",  $html_string);

 return $html_string;

    }
本作品採用《CC 協議》,轉載必須註明作者和本文連結

相關文章