时间:2021-07-01 10:21:17 帮助过:20人阅读
什么样的数据?至少应截个图
转化后的东西太长,所以没有截图
这个是我摘的某个数据(论坛字符限制,只发一小部分)
0x424D465C0C0000000000360000002800000058020000C20100000100180000000000105C0C00000000000000000000000000000000004132AB4132AB4132AB4132AB4132AB4132AB4132AB4132AB4132AB4334AD4334AD4132AB3E2FA83D2EA73F30A93E31B13D32C43B31CB3D33CD3E34CE3F34D03E33CF3E33D03D32CF3D32CF3D32CF3D31D13D31D13D30D23D30D23D30D23D31D13F30D13F32CE3F32CA3F33C94031C84031C8412FC84131C54431C34232BB4133B13F32AC4132AC4231B04530B54331BA3F31B83C33B93D33BB3F35BD4134C04134C04033BF4033BF4334BE4234BC4333BC4234B84032B63F31B44132B24030B33D2DB64131BE4434C74337CD4035D23D32D43E33D74034DA4231D84231D84...
0x424D465C0C0......
这样表示的是一个十六进制数的字符串
你可在读取后去掉前面的 0x 后,用 pack 函数还原出原始内容
$s = pack('H*', substr($s, 2));
你示例的是一个 BMP 图片数据
这个我以前试看到过,不过当时用的是C,现在我用H或者C都是同样的乱码问题,始终解决不了,网上资料介绍说是编码问题,我主要的编码都试过了,还是不行,不知道咋办
虽然没有解决问题,还是谢谢你
尽管你只贴出了数据片段,但仍然能看到你的数据时一个 BMP 图片
$s = '424D465C0C0000000000360000002800000058020000C20100000100180000000000105C0C00000000000000000000000000000000004132AB4132AB4132AB4132AB4132AB4132AB4132AB4132AB4132AB4334AD4334AD4132AB3E2FA83D2EA73F30A93E31B13D32C43B31CB3D33CD3E34CE3F34D03E33CF3E33D03D32CF3D32CF3D32CF3D31D13D31D13D30D23D30D23D30D23D31D13F30D13F32CE3F32CA3F33C94031C84031C8412FC84131C54431C34232BB4133B13F32AC4132AC4231B04530B54331BA3F31B83C33B93D33BB3F35BD4134C04134C04033BF4033BF4334BE4234BC4333BC4234B84032B63F31B44132B24030B33D2DB64131BE4434C74337CD4035D23D32D43E33D74034DA4231D84231D84';$s = pack('H*', $s);$FILE = unpack ( "vfile_type/Vfile_size/Vreserved/Vbitmap_offset" , substr($s, 0, 14 ));print_r($FILE);$BMP = unpack ( 'Vheader_size/Vwidth/Vheight/vplanes/vbits_per_pixel' . '/Vcompression/Vsize_bitmap/Vhoriz_resolution' . '/Vvert_resolution/Vcolors_used/Vcolors_important' , substr( $s, 14, 40 )); print_r($BMP);
Array( [file_type] => 19778 [file_size] => 810054 [reserved] => 0 [bitmap_offset] => 54)Array( [header_size] => 40 [width] => 600 [height] => 450 [planes] => 1 [bits_per_pixel] => 24 [compression] => 0 [size_bitmap] => 810000 [horiz_resolution] => 0 [vert_resolution] => 0 [colors_used] => 0 [colors_important] => 0)