日期:2014-05-17 浏览次数:20448 次
//模拟一个文件
$s = "424d6c0600000000000036000000280000001c00000014000000010018000000";
$fp = tmpfile();
fwrite($fp, pack('H*', $s));
//以十六进制查看
fseek($fp, 0);
$i = 0;
while($i < 32) {
printf('%02x ', ord(fgetc($fp)));
if((++$i % 16) == 0) echo PHP_EOL;
}
/*
42 4d 6c 06 00 00 00 00 00 00 36 00 00 00 28 00
00 00 1c 00 00 00 14 00 00 00 01 00 18 00 00 00
*/
//进入你的问题
fseek($fp, 18);
$t = fread($fp, 4);
echo strlen($t), ' : ', bin2hex($t);
/*
4 : 1c000000
*/