htmlspecialchars() htmlentities() 这两个函数有什么区别吗 ?

WBOY
Release: 2016-06-06 20:31:57
Original
1121 people have browsed it

在PHP 中如何将 HTML代码写入 Mysql 中 , (比如 , 一些前端编辑器的内容)

回复内容:

在PHP 中如何将 HTML代码写入 Mysql 中 , (比如 , 一些前端编辑器的内容)

http://stackoverflow.com/questions/46483/htmlentities-vs-htmlspecialch...
一个是一大票字符 一个是几个字符 准确点说就是" &
老实说我没用过htmlentities 我是看了这个回答才知道htmlentities会转义这么多字符

http://www.w3school.com.cn/php/func_string_htmlspecialchars.asp

http://www.w3school.com.cn/php/func_string_htmlentities.asp

你可以看一下它们的介绍,看你的需要去选择合适的,我觉得两个都是可以用的。

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!