当前位置:网站首页>PHP has its own filtering and escape functions

PHP has its own filtering and escape functions

2022-07-07 16:19:00 Full stack programmer webmaster

classification :

Function name

paraphrase

Introduce

htmlspecialchars

Will work with 、 Single and double quotation marks 、 Greater than and less than sign into HTML Format

& Turn into &amp;“ Turn into &quot;‘ Turn into &#039;< Turn into &lt;> Turn into &gt;

htmlentities()

All characters are converted to HTML Format

Except above htmlspecialchars Out of character , It also includes the display of double byte characters as encoding .

addslashes

Single and double quotation marks 、 Backslash and NULL Escape with backslash

The changed characters include single quotation marks (‘)、 Double quotes (“)、 Backslash backslash (\) And empty characters NULL.

stripslashes

Remove the backslash character

Remove the backslash character from the string . If there are two consecutive backslashes , Then remove one , Leave one . If there is only one backslash , Just get rid of it .

quotemeta

Add reference symbols

Include... In the string . \\ + * ? [ ^ ] ( $ ) Add a backslash in front of the characters such as “\” Symbol .

nl2br()

Convert newline characters to <br>

strip_tags

Get rid of HTML And PHP Mark

Remove any HTML Labelling and PHP Mark , Including the contents between marking and plugging . Note that if the string HTML And PHP There is an error in the label , It also returns an error .

mysql_real_escape_string

escape SQL Special characters in string

escape \x00 \n \r Space \ ‘ ” \x1a, It is very effective for multi byte character processing .mysql_real_escape_string Can judge the character set ,mysql_escape_string You don't have to consider .

base64_decode

base64 decode

To use MIME base64 Decode the encoded data

base64_encode

base64 code

Use MIME base64 Code the data

rawurldecode

URL decode

For encoded URL String decoding

rawurlencode

URL code

according to RFC 1738 Yes URL Encoding

urldecode

URL decode

Decode the encoded URL character string

urlencode

URL code

code URL character string

Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/113210.html Link to the original text :https://javaforall.cn

原网站

版权声明
本文为[Full stack programmer webmaster]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207071406057574.html