PHP character escape Function Summary. sometimes, for the sake of security, we need to escape the character strings entered by the user, which may be incorrect or obscure ~~~
Configurations and functions related to PHP string escaping are as
PHP character escape function summary (the escape string in php ). The article contains incorrect or ambiguous words. please point out ~~~ Configurations and functions related to PHP string escaping are as follows: 1.
Article Which is incorrect or ambiguous ~~~
Configurations and functions related to PhP string escaping are as follows:1. magic_quotes_runtime2. magic_quotes_gpc3. addslashes () and stripslashes ()4. mysql_escape_string ()5. addcslashes () and
JavaScript to convert HTML Escape characters, jshtml escape characters
// Remove the html Tag
Function removeHtmlTab (tab) {return tab. replace (/] +?> /G, ''); // delete all HTML tags}
// Convert normal characters to escape characters
function html2
The article has incorrect or the rhetoric is not clear place, the trouble everybody pointed out ~ ~ ~
The configuration and functions associated with the PHP string escape are as follows:
1.magic_quotes_runtime
2.magic_quotes_gpc
3.addslashes ()
When we write JavaScript scripts, we may want HTML documents to display or use certain special characters (such as quotes or slashes). (For example: ) but as mentioned earlier, when declaring a string, it must be enclosed in quotation marks. As a
Escape () method, which is used to escape any character that cannot be sent correctly in clear text. For example, a space in a phone number is converted to character% 20, which allows the characters to be passed in the
JS Transform HTML escape character
Get rid of HTML tags
function removehtmltab (tab) {return
tab.replace (/]+?>/g, ');//delete all HTML tags
}
Convert ordinary character to signifier
function Html2escape (sHtml) {return
shtml.replace
First, what is an escape characterAn escape character is a special character constant, preceded by a backslash "\" followed by one or several characters. Have a specific meaning, different from the original meaning of the character, it is called
PHP single quotes and double quotes can modify string data. if the modified string contains a variable (for example, $ name), the biggest difference is that double quotes replace the variable value, the single quotation mark will output it as a
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.