php函数·····转换字符串函数

论坛 期权论坛     
选择匿名的用户   2021-5-30 02:01   216   0
<h1 style="border:0px; margin:0px 0px 10px; padding:0px; font-size:2.1em; font-family:&#34;Open Sans&#34;,&#34;Helvetica Neue&#34;,Helvetica,Arial,STHeiti,&#34;Microsoft Yahei&#34;,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:&#34;Microsoft Yahei&#34;,&#34;Helvetica Neue&#34;,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:&#34;Open Sans&#34;,&#34;Helvetica Neue&#34;,Helvetica,Arial,STHeiti,&#34;Microsoft Yahei&#34;,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:&#34;Microsoft Yahei&#34;,&#34;Helvetica Neue&#34;,Helvetica,Arial,sans-serif"> 把预定义的 HTML 实体 &#34;&amp;lt;&#34;(小于)和 &#34;&amp;gt;&#34;(大于)转换为字符:</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:&#34;courier new&#34;; word-break:break-all; word-wrap:break-word; background-color:rgb(255,255,255)">
   &lt;?php
  <br> $str &#61; &#34;This is some &amp;lt;b&amp;gt;bold&amp;lt;/b&amp;gt; text.&#34;;
  <br> echo htmlspecialchars_decode($str);
  <br> ?&gt;
</div>
<p style="border:0px; margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; line-height:2em; font-family:&#34;Microsoft Yahei&#34;,&#34;Helvetica Neue&#34;,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:&#34;courier new&#34;; word-break:break-all; word-wrap:break-word; background-color:rgb(255,255,255)">
   &lt;!DOCTYPE html&gt;
  <br> &lt;html&gt;
  <br> &lt;body&gt;
  <br> This is some &lt;b&gt;bold&lt;/b&gt; text.
  <br> &lt;/body&gt;
  <br> &lt;/html&gt;
</div>
<p style="border:0px; margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; line-height:2em; font-family:&#34;Microsoft Yahei&#34;,&#34;Helvetica Neue&#34;,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:&#34;courier new&#34;; 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:&#34;Open Sans&#34;,&#34;Helvetica Neue&#34;,Helvetica,Arial,STHeiti,&#34;Microsoft Yahei&#34;,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:&#34;Open Sans&#34;,&#34;Helvetica Neue&#34;,Helvetica,Arial,STHeiti,&#34;Microsoft Yahei&#34;,sans-serif"> 定义和用法</h2>
<p style="border:0px; margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; line-height:2em; font-family:&#34;Microsoft Yahei&#34;,&#34;Helvetica Neue&#34;,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:&#34;Microsoft Yahei&#34;,&#34;Helvetica Neue&#34;,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:&#34;Open Sans&#34;,&#34;Helvetica Neue&#34;,Helvetica,Arial,STHeiti,&#34;Microsoft Yahei&#34;,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;amp; 解码成 &amp; (和号)</li><li style="border:0px; margin:0px 0px 1em 1em; padding:0px 0px 0px 1.5em; line-height:1.5em; font-size:1em"> &amp;quot; 解码成 &#34; (双引号)</li><li style="border:0px; margin:0px 0px 1em 1em; padding:0px 0px 0px 1.5em; line-height:1.5em; font-size:1em"> &#39; 解码成 &#39; (单引号)</li><li style="border:0px; margin:0px 0px 1em 1em; padding:0px 0px 0px 1.5em; line-height:1.5em; font-size:1em"> &amp;lt; 解码成 &lt; (小于)</li><li style="border:0px; margin:0px 0px 1em 1em; padding:0px 0px 0px 1.5em; line-height:1.5em; font-size:1
分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP