pack php 详解_函数pack的使用详解
[導讀]pack函數把數據裝入一個二進制字符串。
php pack() 函數定義和用法
pack() 函數把數據裝入一個二進制字符串。
語法pack(format,args+)
參數描述format必需。規定在包裝數據時所使用的格式。args+可選。規定被包裝的一個或多個參數。
format 參數的可能值:
a - nul-padded string
a - space-padded string
h - hex string, low nibble first
h - hex string, high nibble first
c - signed char
c - unsigned char
s - signed short (always 16 bit, machine byte order)
s - unsigned short (always 16 bit, machine byte order)
n - unsigned short (always 16 bit, big endian byte order)
v - unsigned short (always 16 bit, little endian byte order)
i - signed integer (machine dependent size and byte order)
i - unsigned integer (machine dependent size and byte order)
l - signed long (always 32 bit, machine byte order)
l - unsigned long (always 32 bit, machine byte order)
n - unsigned long (always 32 bit, big endian byte order)
v - unsigned long (always 32 bit, little endian byte order)
f - float (machine dependent size and representation)
d - double (machine dependent size and representation)
x - nul byte
x - back up one byte
@ - nul-fill to absolute position
例子例子 1<?phpecho ?pack("c3",80,72,80);?>
輸出:php
例子 2<?phpecho ?pack("c*",80,72,80);?>
輸出:php
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的pack php 详解_函数pack的使用详解的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 解放军消声最好的05式微声冲锋枪
- 下一篇: 印度把石油卖给欧洲、这里的欧洲代表一个国