什么是实时使用PHP包和解包函数? [英] What is the realtime use of PHP pack and unpack function?

查看:123
本文介绍了什么是实时使用PHP包和解包函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  echo pack(ssssss,0x809,0x8, 0x0,0x10,0x0,0x0); 

完全是这样做的吗?

(总是16位,机器字节顺序)

我不知道为什么我不能够实时理解这个。
不要求理论上的答案

当我执行php时,文件生成了一些不被ms excel识别的stange字符。



我只想知道使用pack(),在哪里使用以及如何使用?

解决方案

pack 通常用于生成原始二进制数据。例如,我在用于生成zip文件之前看到本地函数/类在PHP中是可用的。


I saw some file generation codes which uses the pack function.

echo pack("ssssss", 0x809, 0x8, 0x0, 0x10, 0x0, 0x0);

What this is doing exactly?

s signed short (always 16 bit, machine byte order)

I dont know why i am not able to understand this in realtime. Am not asking a theoretical answer

When i execute the php , file got generated with some stange characters which is not identified by ms excel.

I just want to know the use of pack(), where to use and how to use?

解决方案

pack is generally used to generate raw binary data. For example, I saw it used to generate zip files before native functions/classes were available in PHP for that.

这篇关于什么是实时使用PHP包和解包函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆