也可以利用 fseek
和 fwrite
来参照上述文章事理实现:
123456789101112131415
$comment
=
'123测试'
;
$file
=
fopen
(
'R:\1.apk'
,
'r+'
);
fseek
(
$file
, -2, SEEK_END);
fwrite(
$file
, pack(
's'
, mb_strlen(
$comment
,
'8bit'
)));
fwrite(
$file
,
$comment
);
fclose(
$file
);
$zip
=
new
ZipArchive();
$zip
->open(
'R:\1.apk'
);
var_dump(
$zip
->getArchiveComment());
//$zip->setArchiveComment($comment);
//var_dump($zip->getArchiveComment());
$zip
->close();