PHP pack()返回警告和错误的十六进制

时间:2017-12-21 08:32:26

标签: php pack

我有一个密钥,我需要使用pack()转换为HEX。

$key = "78787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878";
$keyBytes = pack('H*',$key);

但是pack()会返回:

p�������

我需要这个:

[0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38, 0x37, 0x38]
我做错了什么?我完全按照我所掌握的手册进行操作。

0 个答案:

没有答案