位置: 编程技术 - 正文

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中字符串函数)

  • 投资性房地产采用成本模式计量
  • 小规模增值税附表一怎么填
  • 纳税调整增加额在报表的哪里
  • 收到上年度所得税发票
  • 怎么导出银行对账单流水
  • 电子承兑汇票贴现流程
  • 税控盘和税控钥匙一样吗
  • 工资中事假扣款执行依据
  • 管理费用福利费和应付职工薪酬福利费区别
  • 发票没作废写上作废了怎么办
  • 小规模免征增值税额度2022
  • 员工上下班交通安全培训
  • 代收税款
  • 工会经费拨缴是什么意思
  • 小规模纳税人开具增值税专用发票
  • 房地产老项目增值税简易计税
  • 进项发票当月不抵扣怎么入账
  • 现金支付业务
  • 购销合同印花税怎么算
  • 企业收到一笔钱不知道什么钱 如何做账
  • 员工社保异地缴纳
  • 幼儿园组织的活动幼儿一定要参加吗
  • 用于当年免征的增值税
  • 股权成本计算公式rd
  • 购买的商业保险可以税前扣除吗
  • 企业对外股权投资涉及税收
  • 增值税及附加税是什么意思
  • 劳务发票税率是多少
  • 小规模纳税人安装费税率
  • 怎么进入bios设置界面设置内存
  • 纳税人如何申请延期缴纳税款
  • 公司用车出现事故用员工赔付么?
  • 预计资产未来现金流量的期限
  • echarts饼图背景图片
  • apache配置多个项目
  • php fileinfo
  • 契税计税依据是成交价还是评估价?
  • 库存股属于什么类账户
  • rgbt目标跟踪
  • php实现文件上传需要使用哪个全局变量
  • 企业持有待售的固定资产,应当对其预计
  • 深度学习知识点简单概述【更新中】
  • 一个用于表示特定的web页的标识符url称为
  • 怎样安装∪sb
  • apache 反射工具类
  • python按行读入
  • 计提本月财务费用会计分录
  • 没进项发票怎么办
  • 筹办期间发生的广告费和业务宣传费可以扣除吗
  • phpcms生成html
  • mongodb创建库
  • 税控盘的服务费可以抵扣吗
  • 弃置费用的现值计入固定资产
  • 企业存货按照经济内容可以分为
  • 个税返还手续费怎么做账
  • sqlserver数据库中进行查询所使用的语言为
  • 租入的房子再出租用交房产税吗?
  • 接受捐赠的固定资产进项税额可以抵扣吗
  • 财政补贴的政策
  • 财政非税收入支付平台
  • 公司员工出差住酒店费用明细有问题怎么办
  • mac系统自带的杀毒软件
  • 如何在macbook中设置软件权限
  • centos nohup
  • mac怎么批量删除qq好友
  • win7系统不能用了?
  • win7怎么调窗口大小
  • linux shell脚本编写实例
  • blockqueue生产者消费者
  • python计算两个数的最大公约数
  • unityxlua热更新方案
  • unity3d怎么用
  • 让ie运行js时提示允许阻止内容运行的解决方法
  • python的iloc
  • 房产税纳税义务终止
  • 安徽国家税务局增值税发票查询平台
  • 广东省职称证书编号查询系统
  • 交叉互查的作用和意义
  • 2021年水资源税征期
  • 高速公路过路费电子发票在哪里开
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设