php 从二进制文件读取数据
php read data from binary file
我找不到问题的答案。我有代码
$arr = array(pack("d",1324),pack("d",151),pack("d",8564));
file_put_contents('C:\Users\Duc Nguyen\Desktop\text.bin', $arr);
所以我得到了一个二进制文件。我使用代码
$s = file_get_contents('C:\Users\Duc Nguyen\Desktop\text.bin');
foreach(unpack("d", $s) as $n)
echo $n;
阅读它,但它没有 work.can 你告诉我如何从文件中读取数据。我不想使用 serialize/unserialize 函数。
谢谢!
我找不到问题的答案。我有代码
$arr = array(pack("d",1324),pack("d",151),pack("d",8564));
file_put_contents('C:\Users\Duc Nguyen\Desktop\text.bin', $arr);
所以我得到了一个二进制文件。我使用代码
$s = file_get_contents('C:\Users\Duc Nguyen\Desktop\text.bin');
foreach(unpack("d", $s) as $n)
echo $n;
阅读它,但它没有 work.can 你告诉我如何从文件中读取数据。我不想使用 serialize/unserialize 函数。 谢谢!