Python打包数据到PHP打包数据
有人可以帮我将此数据转换为 PHP 等效项: >4siiiiiiiiiiiii8x
它在 Python 中的 struct.pack()
中使用。 这是我到目前为止得到的:N14si13x8
它应该返回: ('P3TF', 272, 64, 6832, 6896, 1426, 8336, 312, 8656, 0, 8656, 0, 8656, 2924384)
PHP 版本结果:
array
'si13x81' => int 1345541190
'si13x82' => int 272
'si13x83' => int 64
'si13x84' => int 6832
'si13x85' => int 6896
'si13x86' => int 1426
'si13x87' => int 8336
'si13x88' => int 312
'si13x89' => int 8656
'si13x810' => int 0
'si13x811' => int 8656
'si13x812' => int 0
'si13x813' => int 8656
'si13x814' => int 2924384
仍然需要做对第一个。
could someone help me get this data into the PHP equivalent: >4siiiiiiiiiiiii8x
It is used in struct.pack()
in Python.
this is what i got so far: N14si13x8
it's supposed to be returning: ('P3TF', 272, 64, 6832, 6896, 1426, 8336, 312, 8656, 0, 8656, 0, 8656, 2924384)
The PHP version results:
array
'si13x81' => int 1345541190
'si13x82' => int 272
'si13x83' => int 64
'si13x84' => int 6832
'si13x85' => int 6896
'si13x86' => int 1426
'si13x87' => int 8336
'si13x88' => int 312
'si13x89' => int 8656
'si13x810' => int 0
'si13x811' => int 8656
'si13x812' => int 0
'si13x813' => int 8656
'si13x814' => int 2924384
still need to get the first one right.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想主要问题是
i
和s
在 PHP 中具有不同的含义。要在 PHP 中重新创建原始列表,这似乎可行:给我:
我不太确定
x8
。它不用于 PHP 中的填充。如果它不适用于真实的数据文件,也许可以尝试@
。I guess the main problem is that
i
ands
have different meaning in PHP. To recreate your original list in PHP this seems to work:Gives me:
I'm not so sure about the
x8
. That's not used for padding in PHP. Maybe try@
if it doesn't work on a real datafile.