Preventing XSS from within HTML elements
问题 Is the following enough to prevent XSS from inside HTML elements? function XSS_encode_html ( $str ) { $str = str_replace ( '&', "&", $str ); $str = str_replace ( '<', "<", $str ); $str = str_replace ( '>', ">", $str ); $str = str_replace ( '"', " "", $str ); $str = str_replace ( '\'', " '", $str ); $str = str_replace ( '/', "/", $str ); return $str; } As mentioned here: - https://www.owasp.org/index.php/Abridged_XSS_Prevention_Cheat_Sheet#RULE_.231_-_HTML_Escape_Before_Inserting_Untrusted