Home  >  Article  >  Backend Development  >  How to escape special characters in php

How to escape special characters in php

藏色散人
藏色散人Original
2020-11-25 10:13:123896browse

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. .

How to escape special characters in php

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn