htmlspecialchars($str,ENT_QUOTES);
转义以下字符
-
'&' (ampersand) becomes '&'
-
'"' (double quote) becomes '"' when ENT_NOQUOTES is not set.
-
''' (single quote) becomes ''' only when ENT_QUOTES is set.
-
'<' (less than) becomes '<'
-
'>' (greater than) becomes '>'