This article describes the PHP custom APK installation package method, share to everyone for your reference. The implementation method is as follows:
<?php//source file $apk = "gb.apk";//Generate temporary file $file = Tempnam ("tmp", "zip");//Copy file if (False===file_put_contents ($ File, file_get_contents ($apk))) { exit (' Copy faild! ');} Open temporary file $zip = new ziparchive (); $zip->open ($file);//Add files//Because the APK limit can only modify files in this directory, otherwise it will be reported invalid APK package $zip-> AddFromString (' Meta-inf/extends.json ', Json_encode (Array (' author ' = ' Deeka ')));//close Zip$zip->close ();// Download the file header ("Content-type:application/zip"); Header ("Content-length:"). FileSize ($file)); header ("Content-disposition:attachment; Filename=\ "{$apk}\");//output Binary stream ReadFile ($file);//Delete temporary file unlink ($file); >
PHP Custom APK installation Package instance