位置: 编程技术 - 正文

PHP字符串函数html_entity_decode()的用法(php字符串赋值)

编辑:rootadmin
html_entity_decode

推荐整理分享PHP字符串函数html_entity_decode()的用法(php字符串赋值),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:php字符串函数大全,php字符串赋值,php 字符串,php中字符串函数,php字符串的三种定义方式,php字符串的三种定义方式,php字符串的三种定义方式,php 字符串,内容如对您有帮助,希望把文章链接给更多的朋友!

(PHP 4 >= 4.3.0, PHP 5)

html_entity_decode — Convert all HTML entities to their applicable characters

说明 string html_entity_decode ( string $string [, int $flags = ENT_COMPAT | ENT_HTML [, string $encoding = ini_get("default_charset") ]] )

html_entity_decode() is the opposite of htmlentities() in that it converts all HTML entities in the string to their applicable characters.

More precisely, this function decodes all the entities (including all numeric entities) that a) are necessarily valid for the chosen document type — i.e., for XML, this function does not decode named entities that might be defined in some DTD — and b) whose character or characters are in the coded character set associated with the chosen encoding and are permitted in the chosen document type. All other entities are left as is.

参数

string

The input string.

flags

A bitmask of one or more of the following flags, which specify how to handle quotes and which document type to use. The default is ENT_COMPAT | ENT_HTML. Available flags constants Constant Name Description ENT_COMPAT Will convert double-quotes and leave single-quotes alone. ENT_QUOTES Will convert both double and single quotes. ENT_NOQUOTES Will leave both double and single quotes unconverted. ENT_HTML Handle code as HTML 4.. ENT_XML1 Handle code as XML 1. ENT_XHTML Handle code as XHTML. ENT_HTML5 Handle code as HTML 5.

encoding

An optional argument defining the encoding used when converting characters.

If omitted, the default value of the encoding varies depending on the PHP version in use. In PHP 5.6 and later, the default_charset configuration option is used as the default value. PHP 5.4 and 5.5 will use UTF-8 as the default. Earlier versions of PHP use ISO--1.

PHP字符串函数html_entity_decode()的用法(php字符串赋值)

Although this argument is technically optional, you are highly encouraged to specify the correct value for your code if you are using PHP 5.5 or earlier, or if your default_charset configuration option may be set incorrectly for the given input.

支持以下字符集: 支持的字符集列表 字符集 别名 描述 ISO--1 ISO-1 西欧,Latin-1 ISO--5 ISO-5 Little used cyrillic charset (Latin/Cyrillic). ISO-- ISO- 西欧,Latin-9。增加欧元符号,法语和芬兰语字母在 Latin-1(ISO--1) 中缺失。 UTF-8 ASCII 兼容的多字节 8 位 Unicode。 cp ibm, DOS 特有的西里尔编码。本字符集在 4.3.2 版本中得到支持。 cp Windows-, win-, Windows 特有的西里尔编码。本字符集在 4.3.2 版本中得到支持。 cp Windows-, Windows 特有的西欧编码。 KOI8-R koi8-ru, koi8r 俄语。本字符集在 4.3.2 版本中得到支持。 BIG5 繁体中文,主要用于中国台湾省。 GB 简体中文,中国国家标准字符集。 BIG5-HKSCS 繁体中文,附带香港扩展的 Big5 字符集。 Shift_JIS SJIS, 日语 EUC-JP EUCJP 日语 MacRoman Mac OS 使用的字符串。 &#;&#; An empty string activates detection from script encoding (Zend multibyte), default_charset and current locale (see nl_langinfo() and setlocale()), in this order. Not recommended.

Note: 其他字符集没有认可。将会使用默认编码并抛出异常。

返回值

Returns the decoded string.

更新日志

版本 说明 5.6.0 The default value for the encoding parameter was changed to be the value of the default_charset configuration option. 5.4.0 Default encoding changed from ISO--1 to UTF-8. 5.4.0 The constants ENT_HTML, ENT_XML1, ENT_XHTML and ENT_HTML5 were added.

范例

Example #1 Decoding HTML entities

<?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;nowecho$b;//I'll"walk"the<b>dog</b>now?>

注释

Note:

You might wonder why trim(html_entity_decode(&#;&nbsp;&#;)); doesn&#;t reduce the string to an empty string, that&#;s because the &#;&nbsp;&#; entity is not ASCII code (which is stripped by trim()) but ASCII code (0xa0) in the default ISO -1 encoding.

参见

htmlentities() - Convert all applicable characters to HTML entities htmlspecialchars() - Convert special characters to HTML entities get_html_translation_table() - 返回使用 htmlspecialchars 和 htmlentities 后的转换表 urldecode() - 解码已编码的 URL 字符串

PHP字符串函数hex2bin()的用法 hex2bin(PHP=5.4.0)hex2bin转换十六进制字符串为二进制字符串说明stringhex2bin(string$data)转换十六进制字符串为二进制字符串。Caution这个函数不是转换十六进制

PHP字符串函数hebrevc()的用法 hebrevc(PHP4,PHP5)hebrevc将逻辑顺序希伯来文(logical-Hebrew)转换为视觉顺序希伯来文(visual-Hebrew),并且转换换行符说明stringhebrevc(string$hebrew_text[,int$max_char

PHP字符串函数hebrev()的用法 hebrev(PHP4,PHP5)hebrev将逻辑顺序希伯来文(logical-Hebrew)转换为视觉顺序希伯来文(visual-Hebrew)说明stringhebrev(string$hebrew_text[,int$max_chars_per_line=0])将逻辑顺

标签: php字符串赋值

本文链接地址:https://www.jiuchutong.com/biancheng/279857.html 转载请保留说明!

上一篇:PHP字符串函数htmlspecialchars_decode()的用法(php 字符串)

下一篇:PHP字符串函数hex2bin()的用法(php中字符串函数)

  • 购销合同印花税按70%
  • 外商投资合伙企业的性质与特征
  • 个税抵扣夫妻双方只要一个人填写吗
  • 会计核算是否健全 填错了有影响吗
  • 企业所得税抵扣项
  • 火车票进项抵扣怎么勾选
  • 民办非企业单位是私立还是公立
  • 财务报表提示未审计
  • 辞退员工补偿的月平均工资如何计算
  • 营改增之后账务怎么处理
  • 矿泉水资源税计税依据
  • 手工做账流程图
  • 出口收入没有及时申报怎么处罚
  • 自己开发app能享受医保吗
  • 税务局加强企业所得税管理
  • 企业债务重组的案例
  • 分公司所得税怎么交
  • 怎么在电子税务局变更财务负责人
  • 车改补贴是否计入工资总额
  • 资产负债表本期盈余是负数怎么办
  • 印花税走什么费用
  • 境外个人所得税计算
  • 赎回公司发行的债券怎么做账?
  • 不同业务的进项税额抵扣
  • 总公司和分公司的关系证明
  • 抵债资产会计核算办法
  • 公司名下商品房卖给个人后房产税怎么交
  • 没有实缴的股份转让要交个人所得税吗
  • 提取利润会计分录怎么做
  • 怎么给自己的宽带改名字
  • 接入设备检测
  • 网络打印机找不到网络路径
  • 注意力机制加在CNN的什么位置
  • afn取消请求
  • 程序员 cr
  • php session跨域共享
  • get请求有哪些
  • 离职补偿金可以拖欠么
  • 运输发票是怎样计提的
  • 主营业务成本可以设置二级科目吗
  • Python怎么转化为中文
  • 工地购买的厨房用品计入哪个科目
  • 合同资产与应收账款的关系
  • redis的
  • mongodb连接数
  • mongodb数据库基本操作
  • 财务费用相关指标
  • 进项税额在贷方怎么办
  • 餐饮服务需要卫生许可证吗
  • 经审计的财务报表是否要会计师事务所盖章
  • 劳务费发票入账科目
  • 应收分保未到期责任准备金是什么科目
  • 企业送员工的礼品
  • 合伙企业一般纳税人六税两费
  • 新公司成立建账流程
  • 销售费用明细科目有哪些内容
  • 硬盘安装在哪里
  • 苹果的os什么意思
  • linux file-nr
  • efi shell有什么用
  • win8系统打开不了软件
  • pb程序是什么
  • winxp系统笔记本电脑如何开启无线网络
  • 网站遇到错误号怎么办
  • Windows 8.1 RT Update 3更新将于9月发布
  • win10系统无法启动
  • 红石id
  • linux查看使用率命令
  • 一系列优秀的Android开发资料
  • android开机自启动显示界面
  • windows、linux
  • android设置hint颜色
  • android 圆形图片
  • nodejs inspect
  • c# hashtable 用法
  • 用javascript
  • 国家税务总局深圳税局
  • 360浏览器hi真不巧
  • 深圳税局电子税务局
  • 企业以自有物业为单位
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

    网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

    友情链接: 武汉网站建设