$file_pointer = fopen($file, "r"); $file_read = fread($file_pointer, filesize($file)); //$file_read = fread($file_pointer, 1); fclose($file_pointer); $string = asc2bin(($file_read));//转换为二进制流 111111110000000010101010 $string = bin2hex($file_read);//十六进制字符串 8f6d3b //转换为二进制流 function asc2bin($temp) { $len = strlen($temp); for ($i = 0; $i < $len; $i++) { $data .= sprintf(‘%08b‘, ord(substr($temp, $i, 1))); } return $data; }
时间: 2024-10-11 12:35:04