php HTML安全过滤

  /*HTML安全过滤*/ 
        function _htmtocode($content) { 
                $content = str_replace('%','%‎',$content); 
                $content = str_replace("<", "&lt;", $content); 
                $content = str_replace(">", "&gt;", $content);             
                $content = str_replace("\n", "<br/>", $content); 
                $content = str_replace(" ", "&nbsp;", $content); 
                $content = str_replace('"', "&quot;", $content); 
                $content = str_replace("'", "&#039;", $content); 
                $content = str_replace("$", "&#36;", $content); 
                $content = str_replace('}','&rlm;}',$content); 
                return $content; 
        } 

 

你可能感兴趣的:(php HTML安全过滤)