Home > Article > Backend Development > How to escape special characters in php
php method of escaping special characters: 1. Use addslashes to make backslashes quote strings; 2. Use stripslashes to backquote a quoted string; 3. Use htmlspecialchars to convert specific characters into html entities. .
The operating environment of this tutorial: Windows 7 system, PHP version 5.6. This method is suitable for all brands of computers.
Recommended: "PHP Video Tutorial"
php Escape special characters
1. Use addslashes() Backslash quoted string
and
stripslashes() backquotes a quoted string
2. htmlentities(): Convert to html entity
and html_entity_decode(): convert html entities into html tags
3, htmlspecialchars(): convert specific characters into html entities
and htmlspecialchars_decode(): vice versa
The above is the detailed content of How to escape special characters in php. For more information, please follow other related articles on the PHP Chinese website!