Home >Backend Development >PHP Tutorial >怎么获取字符(包含文字)所对应的HTML实体编号

怎么获取字符(包含文字)所对应的HTML实体编号

WBOY
WBOYOriginal
2016-06-13 12:14:461121browse

如何获取字符(包含文字)所对应的HTML实体编号
请问,PHP如何获取字符(包含文字)所对应的HTML实体编号,如
数字3对应的是3

------解决思路----------------------
不对,应该统一化为 unicode 编码

$s = iconv('gbk', 'ucs-2', '请问,PHP如何获取字符(包含文字)所对应的HTML实体编号,如 数字3对应的是3');<br />echo '&#' . join(';&#', unpack('n*', $s)) . ';';<br />
请问,PHP如何获取字符(包含文字)所对应的HTML实体编号,如 数字3对应的是3

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn