V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
baocaixiong
V2EX  ›  PHP

请教,如何将 Python 代码: struct.unpack('<Q', binascii.unhexlify('b2bf98ce44010000')) 翻译成 PHP?

  •  
  •   baocaixiong · May 14, 2016 · 2740 views
    This topic created in 3637 days ago, the information mentioned may be changed or developed.
    import struct
    import binascii
    print struct.unpack('<Q', binascii.unhexlify('b2bf98ce44010000'))
    2 replies    2016-05-14 22:13:54 +08:00
    MrZephyrus
        1
    MrZephyrus  
       May 14, 2016
    http://www.php.net/manual/zh/function.unpack.php
    php 也能 unpack 二进制数据啊
    baocaixiong
        2
    baocaixiong  
    OP
       May 14, 2016
    @MrZephyrus
    嗯,忘记说了, unpack 在 5.6 之前不支持 P 参数,也就是 int64

    我一直在 5.5 的环境弄的
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   961 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 20:04 · PVG 04:04 · LAX 13:04 · JFK 16:04
    ♥ Do have faith in what you're doing.