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; 
        } 

 

posted @ 2016-02-02 13:28  侠岚之弋痕夕  阅读(185)  评论(0编辑  收藏  举报
Where is the starting point, we don't have a choice, but the destination where we can pursue!