最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
php html_entity_decode实例教程
时间:2022-07-02 09:52:45 编辑:袖梨 来源:一聚教程网
YPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.*w**3.org/TR/REC-html40/loose.dtd">
关于html_entity_decode在大多数情况下是与htmlspecialchars htmlentities配合使用的
html_entity_decode用法:
string html_entity_decode ( string $string [, int $quote_style = ENT_COMPAT [, string $charset ]] )
html_entity_decode() 函数把 HTML 实体转换为字符。
html_entity_decode() 是 htmlentities() 的反函数也html_entity_decode() 是 htmlspecialchars() 的反函数。
$str = "A 'quote' is bold >";
Outputs: A 'quote' is <b>bold</b>
$s = htmlspecialchars($str);
echo $s;
Outputs: A 'quote' is <b>boldwww.111com.net</b>
echo html_entity_decode($s);
A 'quote' is bold
再看一个实例
$str = "John & 'Adams'";
echo html_entity_decode($str);
echo "
";
echo html_entity_decode($str, ENT_QUOTES);
echo "
";
echo html_entity_decode($str, ENT_NOQUOTES);
?>浏览器输出:
John & 'Adams'
John & 'Adams'
John & 'Adams'如果在浏览器中查看源代码,会看到这些 HTML:
John & 'Adams'
John & 'Adams'
John & 'Adams'
相关文章
- 鸣潮藏馆寻宝者成就怎么达成 藏馆寻宝者成就达成攻略 10-26
- 伊莫虹光星魔师怎么获取 虹光星魔师获取攻略 10-26
- 星塔旅人什么阵容厉害 新手强力阵容搭配推荐 10-26
- 燕云十六声偷师方法介绍及开启方法 10-26
- 燕云十六声细语蜂窝收集方法分享 10-26
- 燕云十六声归燕经获取及小十七打法 10-26