如何正确使用PHP中的htmlspecialchars_decode函数进行解码?
- 内容介绍
- 文章标签
- 相关推荐
本文共计657个文字,预计阅读时间需要3分钟。
PHP中使用`specialchars_decode`函数将预定义的HTML实体转换为字符:
php输出结果:This is some bold text.
PHP htmlspecialchars_decode() 函数
实例
把预定义的 HTML 实体 "<"(小于)和 ">"(大于)转换为字符:
<?php $str = "This is some <b>bold</b> text."; echo htmlspecialchars_decode($str); ?>
上面代码的 HTML 输出如下(查看源代码):
<!DOCTYPE html> <html> <body> This is some <b>bold</b> text. </body> </html>
上面代码的浏览器输出如下:
This is some **bold** text.
定义和用法
htmlspecialchars_decode()函数把一些预定义的 HTML 实体转换为字符。
本文共计657个文字,预计阅读时间需要3分钟。
PHP中使用`specialchars_decode`函数将预定义的HTML实体转换为字符:
php输出结果:This is some bold text.
PHP htmlspecialchars_decode() 函数
实例
把预定义的 HTML 实体 "<"(小于)和 ">"(大于)转换为字符:
<?php $str = "This is some <b>bold</b> text."; echo htmlspecialchars_decode($str); ?>
上面代码的 HTML 输出如下(查看源代码):
<!DOCTYPE html> <html> <body> This is some <b>bold</b> text. </body> </html>
上面代码的浏览器输出如下:
This is some **bold** text.
定义和用法
htmlspecialchars_decode()函数把一些预定义的 HTML 实体转换为字符。

