也可以利用 fseekfwrite 来参照上述文章事理实现:

php生成apkPHP修正apk文件的comment实现 SQL

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();