最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

PHP html_entity_decode()函數(shù)講解

 更新時(shí)間:2019年02月25日 16:28:48   作者:php參考手冊  
今天小編就為大家分享一篇關(guān)于PHP html_entity_decode()函數(shù)講解,小編覺得內(nèi)容挺不錯的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來看看吧

PHP html_entity_decode() 函數(shù)

實(shí)例

把 HTML 實(shí)體轉(zhuǎn)換為字符:

<?php 
$str = "&lt;&copy; W3CS&ccedil;h&deg;&deg;&brvbar;&sect;&gt;"; 
echo html_entity_decode($str); 
?>

上面代碼的 HTML 輸出如下(查看源代碼):

<!DOCTYPE html> 
<html> 
<body> 
<© W3CSçh°°¦§> 
</body> 
</html>

上面代碼的瀏覽器輸出如下:

<© W3CSçh°°¦§>

定義和用法

html_entity_decode() 函數(shù)把 HTML 實(shí)體轉(zhuǎn)換為字符。

html_entity_decode() 函數(shù)是htmlentities() 函數(shù)的反函數(shù)。

語法

html_entity_decode( _string,flags,character-se_ t)

實(shí)例 1

把一些 HTML 實(shí)體轉(zhuǎn)換為字符:

<?php 
$str = "Jane &amp; &#039;Tarzan&#039;"; 
echo html_entity_decode($str, ENT_COMPAT); // Will only convert double quotes 
echo "<br>"; 
echo html_entity_decode($str, ENT_QUOTES); // Converts double and single
quotes 
echo "<br>"; 
echo html_entity_decode($str, ENT_NOQUOTES); // Does not convert any quotes 
?>

上面代碼的 HTML 輸出如下(查看源代碼):

<!DOCTYPE html> 
<html> 
<body> 
Jane & &#039;Tarzan&#039;<br> 
Jane & 'Tarzan'<br> 
Jane & &#039;Tarzan&#039; 
</body> 
</html>

上面代碼的瀏覽器輸出如下:

Jane & 'Tarzan' 
Jane & 'Tarzan' 
Jane & 'Tarzan'

實(shí)例 2

通過使用西歐字符集,把一些 HTML 實(shí)體轉(zhuǎn)換為字符:

<?php 
$str = "My name is &Oslash;yvind &Aring;sane. I&#039;m Norwegian."; 
echo html_entity_decode($str, ENT_QUOTES, "ISO-8859-1"); 
?>

The HTML output of the code above will be (View Source):

<!DOCTYPE html> 
<html> 
<body> 
My name is Øyvind Åsane. I'm Norwegian. 
</body> 
</html>

上面代碼的瀏覽器輸出如下:

My name is Øyvind Åsane. I'm Norwegian.

總結(jié)

以上就是這篇文章的全部內(nèi)容了,希望本文的內(nèi)容對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,謝謝大家對腳本之家的支持。如果你想了解更多相關(guān)內(nèi)容請查看下面相關(guān)鏈接

相關(guān)文章

最新評論

武宁县| 新昌县| 泸溪县| 工布江达县| 永修县| 鸡东县| 霍邱县| 太仓市| 鄯善县| 达尔| 金门县| 厦门市| 大城县| 东乡| 汕头市| 合作市| 建德市| 讷河市| 古丈县| 罗田县| 巢湖市| 瑞金市| 文昌市| 定兴县| 鄂尔多斯市| 富平县| 连江县| 卢氏县| 澎湖县| 陕西省| 贡嘎县| 益阳市| 潼南县| 西昌市| 宜春市| 永济市| 资兴市| 罗山县| 普兰县| 桓台县| 惠安县|