【问题标题】:Why does AMFPHP store integers as two bytes for the AMF protocol?为什么 AMFPHP 将整数存储为 AMF 协议的两个字节?
【发布时间】:2009-12-04 18:15:37
【问题描述】:

我想知道是否有熟悉 AMFPHP 或低级数据存储的人可以解释为什么整数被存储为两个字节而不是四个字节。据我所知,AMF3 协议需要一个四字节整数。序列化器中的具体代码如下:

/**
 * writeInt takes an int and writes it as 2 bytes to the output stream
 * 0-65535 range
 * 
 * @param int $n An integer to convert to a 2 byte binary string
 */
function writeInt($n) {
    $this->outBuffer .= pack("n", $n); // use pack with the n flag
} 

我知道这个问题可能太具体了,但是谁能帮助回答我的问题?

【问题讨论】:

    标签: php integer amfphp


    【解决方案1】:

    请参阅此处以获得一个很好的解释它是如何工作的: AMF message structure?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-04-22
      • 2012-05-23
      • 1970-01-01
      • 2017-06-08
      • 1970-01-01
      • 2021-08-30
      • 2013-03-25
      • 2021-09-28
      相关资源
      最近更新 更多