简体   繁体   English

如何在PHP中进行十六进制解码?

[英]How to hex decode in php?

I got this string which is I guess Hex encoded: 我得到这个字符串,我猜是十六进制编码:

<?
$s="&#x6c;&#x65;&#x63;&#x68;&#x61;&#x75";
echo chr(hexdec($s))

?>

How can I decode it ? 我怎么解码呢?

They are HTML encoded unicode characters, not a hex-encoded string. 它们是HTML编码的unicode字符,而不是十六进制编码的字符串。 To decode this, you can use html_entity_decode() , as follows: 要对此进行解码,您可以使用html_entity_decode() ,如下所示:

echo html_entity_decode($s);

Will produce: 会产生:

lechau

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM