PHP html_entity_decode() 函数

(PHP 4 >= 4.3.0, PHP 5, PHP 7)

html_entity_decode — 转换HTML相关实体字符

说明

html_entity_decode ( string $string [, int $flags = ENT_COMPAT | ENT_HTML401 [, string $encoding = ini_get("default_charset") ]] ) : string

范例

Example #1 解码 HTML 实体

<?php
$orig = "I'll \"walk\" the <b>dog</b> now";

$a = htmlentities($orig);

$b = html_entity_decode($a);

echo $a; // I'll &quot;walk&quot; the &lt;b&gt;dog&lt;/b&gt; now

echo $b; // I'll "walk" the <b>dog</b> now
?>