function get_num_pages_doc($filename)
{
$handle = fopen($filename, 'r');
$line = @fread($handle, filesize($filename)); echo '<div style="font-family: courier new;">'; $hex = bin2hex($line);
$hex_array = str_split($hex, 4);
$i = 0;
$line = 0;
$collection = '';
foreach($hex_array as $key => $string)
{
$collection .= hex_ascii($string);
$i++; if($i == 1)
{
echo '<b>'.sprintf('%05X', $line).'0:</b> ';
} echo strtoupper($string).' '; if($i == 8)
{
echo ' '.$collection.' <br />'."\n";
$collection = '';
$i = 0; $line += 1;
}
} echo '</div>'; exit();
} function hex_ascii($string, $html_safe = true)
{
$return = ''; $conv = array($string);
if(strlen($string) > 2)
{
$conv = str_split($string, 2);
} foreach($conv as $string)
{
$num = hexdec($string); $ascii = '.';
if($num > 32)
{
$ascii = unichr($num);
} if($html_safe AND ($num == 62 OR $num == 60))
{
$return .= htmlentities($ascii);
}
else
{
$return .= $ascii;
}
} return $return;
} function unichr($intval)
{
return mb_convert_encoding(pack('n', $intval), 'UTF-8', 'UTF-16BE');
}
007000: 0500 5300 7500 6D00 6D00 6100 7200 7900 ..S.u.m.m.a.r.y.
007010: 4900 6E00 6600 6F00 7200 6D00 6100 7400 I.n.f.o.r.m.a.t.
007020: 6900 6F00 6E00 0000 0000 0000 0000 0000 i.o.n...........
007030: 0000 0000 0000 0000 0000 0000 0000 0000 ................007040: 2800 0201 FFFF FFFF FFFF FFFF FFFF FFFF (...ÿÿÿÿÿÿÿÿÿÿÿÿ
007050: 0000 0000 0000 0000 0000 0000 0000 0000 ................
007060: 0000 0000 0000 0000 0000 0000 0000 0000 ................
007070: 0000 0000 2500 0000 0010 0000 0000 0000 ....%...........
{
$handle = fopen($filename, 'r');
$line = @fread($handle, filesize($filename)); echo '<div style="font-family: courier new;">'; $hex = bin2hex($line);
$hex_array = str_split($hex, 4);
$i = 0;
$line = 0;
$collection = '';
foreach($hex_array as $key => $string)
{
$collection .= hex_ascii($string);
$i++; if($i == 1)
{
echo '<b>'.sprintf('%05X', $line).'0:</b> ';
} echo strtoupper($string).' '; if($i == 8)
{
echo ' '.$collection.' <br />'."\n";
$collection = '';
$i = 0; $line += 1;
}
} echo '</div>'; exit();
} function hex_ascii($string, $html_safe = true)
{
$return = ''; $conv = array($string);
if(strlen($string) > 2)
{
$conv = str_split($string, 2);
} foreach($conv as $string)
{
$num = hexdec($string); $ascii = '.';
if($num > 32)
{
$ascii = unichr($num);
} if($html_safe AND ($num == 62 OR $num == 60))
{
$return .= htmlentities($ascii);
}
else
{
$return .= $ascii;
}
} return $return;
} function unichr($intval)
{
return mb_convert_encoding(pack('n', $intval), 'UTF-8', 'UTF-16BE');
}
007000: 0500 5300 7500 6D00 6D00 6100 7200 7900 ..S.u.m.m.a.r.y.
007010: 4900 6E00 6600 6F00 7200 6D00 6100 7400 I.n.f.o.r.m.a.t.
007020: 6900 6F00 6E00 0000 0000 0000 0000 0000 i.o.n...........
007030: 0000 0000 0000 0000 0000 0000 0000 0000 ................007040: 2800 0201 FFFF FFFF FFFF FFFF FFFF FFFF (...ÿÿÿÿÿÿÿÿÿÿÿÿ
007050: 0000 0000 0000 0000 0000 0000 0000 0000 ................
007060: 0000 0000 0000 0000 0000 0000 0000 0000 ................
007070: 0000 0000 2500 0000 0010 0000 0000 0000 ....%...........
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货