1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > php读取远程二进制文件 php 读取二进制文件

php读取远程二进制文件 php 读取二进制文件

时间:2018-10-30 17:10:09

相关推荐

php读取远程二进制文件 php 读取二进制文件

php 读取二进制文件

classHex

{

var$file;

var$hex;

function__construct($file)

{

$this->file=$file;

}

functiongethex()

{

$handle=fopen($this->file,'r')ordie('Haiipermessi?');

while(!feof($handle))

{

foreach(unpack('C*',fgets($handle))as$dec)

{

$tmp=dechex($dec);

$this->hex[].=strtoupper(str_repeat('0',2-strlen($tmp)).$tmp);

}

}

returnjoin($this->hex);

}

functionwritehex($hexcode)

{

foreach(str_split($hexcode,2)as$hex)

{

$tmp.=pack('C*',hexdec($hex));

}

$handle=fopen($this->file,'w+')ordie('Haiipermessi?');

fwrite($handle,$tmp);

}

}

?>

include('hex.class.php');

$obj=newHex('test');

$hexcode=$_POST['hexcode'];

if($hexcode)

{

$obj->writehex(trim($hexcode));

print'

0k.

';

}

?>

=trim($obj->gethex())?>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。