国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > PHP > 正文

php html_entity_decode實例教程

2024-09-04 11:49:05
字體:
來源:轉載
供稿:網友

關于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() 的反函數.

  1. $str = "A 'quote' is bold www.survivalescaperooms.com"
  2.  
  3. Outputs: A 'quote' is <b>bold</b> 
  4. $s = htmlspecialchars($str); 
  5.  
  6. echo $s
  7.  
  8. Outputs: A 'quote' is <b>boldwww.111cn.net</b> 
  9.  
  10. echo html_entity_decode($s); 
  11.  
  12. 'quote' is bold 
再看一個實例,代碼如下:
  1. $str = "John & 'Adams'"
  2. echo html_entity_decode($str); 
  3. echo ""
  4. echo html_entity_decode($str, ENT_QUOTES); 
  5. echo ""
  6. echo html_entity_decode($str, ENT_NOQUOTES); 
  7. ?>//開源代碼Vevb.com 
  8. //瀏覽器輸出: 
  9. John & 'Adams' 
  10. John & 'Adams' 
  11. John & 'Adams' 

如果在瀏覽器中查看源代碼,會看到這些 HTML:

  1. <html> 
  2. <body> 
  3. John & 'Adams'<br /> 
  4. John & 'Adams'<br /> 
  5. John & 'Adams' 
  6. body> 
  7. html>

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 梅河口市| 江城| 山东省| 昌吉市| 邻水| 平安县| 嵊泗县| 新宁县| 琼结县| 武平县| 临江市| 怀安县| 双柏县| 宁津县| 博客| 马山县| 台前县| 阿鲁科尔沁旗| 拉萨市| 越西县| 尼勒克县| 汉源县| 礼泉县| 昌黎县| 淮南市| 青铜峡市| 宁阳县| 漳浦县| 韶山市| 正安县| 朝阳区| 高雄县| 盐源县| 德化县| 定结县| 鱼台县| 石屏县| 榆林市| 临沧市| 黎平县| 合山市|