<h1 style="border:0px; margin:0px 0px 10px; padding:0px; font-size:2.1em; font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,STHeiti,"Microsoft Yahei",sans-serif"> PHP <span class="color_h1" style="border:0px; margin:0px; padding:0px; color:rgb(100,133,76)">htmlspecialchars_decode()</span> 函数</h1>
<p style="border:0px; margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; line-height:2em; font-family:"Microsoft Yahei","Helvetica Neue",Helvetica,Arial,sans-serif; color:rgb(51,51,51)"> <a href="http://www.runoob.com/php/php-ref-string.html" rel="noopener noreferrer" style="border:0px; margin:0px; padding:0px; color:rgb(100,133,76)" target="_blank"><img alt="PHP String 参考手册" class="navup" src="https://beijingoptbbs.oss-cn-beijing.aliyuncs.com/cs/5606289-407b519e7650cc1c7e4ea5b2aa38ebaa.gif" style="border:0px; margin:0px; padding:0px; max-width:100%; height:auto"> PHP String 参考手册</a></p>
<div class="example" style="border:1px solid rgb(212,212,212); margin:0px 0px 5px; padding:5px; width:715.781px; font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,STHeiti,"Microsoft Yahei",sans-serif; background-color:rgb(229,238,204)">
<h2 class="example" style="border:0px; margin:0px 0px 2px; padding:0px; font-size:14.4px; line-height:1.8em; color:rgb(97,127,16); background-color:transparent"> 实例</h2>
<p style="border:0px; margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; line-height:2em; font-family:"Microsoft Yahei","Helvetica Neue",Helvetica,Arial,sans-serif"> 把预定义的 HTML 实体 "&lt;"(小于)和 "&gt;"(大于)转换为字符:</p>
<div class="example_code notranslate" style="border:1px solid rgb(212,212,212); margin:0px; padding:5px; width:701.453px; font-size:13.2px; font-family:"courier new"; word-break:break-all; word-wrap:break-word; background-color:rgb(255,255,255)">
<?php
<br> $str = "This is some &lt;b&gt;bold&lt;/b&gt; text.";
<br> echo htmlspecialchars_decode($str);
<br> ?>
</div>
<p style="border:0px; margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; line-height:2em; font-family:"Microsoft Yahei","Helvetica Neue",Helvetica,Arial,sans-serif"> 上面代码的 HTML 输出如下(查看源代码):</p>
<div class="example_code notranslate" style="border:1px solid rgb(212,212,212); margin:0px; padding:5px; width:701.453px; font-size:13.2px; font-family:"courier new"; word-break:break-all; word-wrap:break-word; background-color:rgb(255,255,255)">
<!DOCTYPE html>
<br> <html>
<br> <body>
<br> This is some <b>bold</b> text.
<br> </body>
<br> </html>
</div>
<p style="border:0px; margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; line-height:2em; font-family:"Microsoft Yahei","Helvetica Neue",Helvetica,Arial,sans-serif"> 上面代码的浏览器输出如下:</p>
<div class="example_code notranslate" style="border:1px solid rgb(212,212,212); margin:0px; padding:5px; width:701.453px; font-size:13.2px; font-family:"courier new"; word-break:break-all; word-wrap:break-word; background-color:rgb(255,255,255)">
This is some
<span style="border:0px; margin:0px; padding:0px">bold</span> text.
</div>
<br>
</div>
<hr style="color:rgb(212,212,212); height:1px; border:0px; clear:both; font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,STHeiti,"Microsoft Yahei",sans-serif; background-color:rgb(212,212,212)">
<h2 style="border:0px; margin:2px 0px; padding:0px; font-size:1.8em; line-height:1.8em; color:rgb(51,51,51); font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,STHeiti,"Microsoft Yahei",sans-serif"> 定义和用法</h2>
<p style="border:0px; margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; line-height:2em; font-family:"Microsoft Yahei","Helvetica Neue",Helvetica,Arial,sans-serif; color:rgb(51,51,51)"> htmlspecialchars_decode() 函数把一些预定义的 HTML 实体转换为字符。</p>
<p style="border:0px; margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; line-height:2em; font-family:"Microsoft Yahei","Helvetica Neue",Helvetica,Arial,sans-serif; color:rgb(51,51,51)"> 会被解码的 HTML 实体是:</p>
<ul style="border:0px; margin:1em 0px; padding:0px; line-height:16.8px; list-style-type:none; color:rgb(51,51,51); font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,STHeiti,"Microsoft Yahei",sans-serif"><li style="border:0px; margin:0px 0px 1em 1em; padding:0px 0px 0px 1.5em; line-height:1.5em; font-size:1em"> &amp; 解码成 & (和号)</li><li style="border:0px; margin:0px 0px 1em 1em; padding:0px 0px 0px 1.5em; line-height:1.5em; font-size:1em"> &quot; 解码成 " (双引号)</li><li style="border:0px; margin:0px 0px 1em 1em; padding:0px 0px 0px 1.5em; line-height:1.5em; font-size:1em"> ' 解码成 ' (单引号)</li><li style="border:0px; margin:0px 0px 1em 1em; padding:0px 0px 0px 1.5em; line-height:1.5em; font-size:1em"> &lt; 解码成 < (小于)</li><li style="border:0px; margin:0px 0px 1em 1em; padding:0px 0px 0px 1.5em; line-height:1.5em; font-size:1 |
|