Exec function execution error -- Application: PHP extract apk icon image by Lin Zimu wolinxuebin reprinted please keep: invalid exec function execution error -- Application: PHP extract apk icon image
Author: Lin Zimu wolinxuebin
Reprinted please keep: http://blog.csdn.net/wolinxuebin
I am working on a project today to read the image icon information from the apk. Because there is a large amount of data to be read, and now all the data that I tested is processed in the windows environment, the data is uploaded to the server after the data is processed. it has really been a long time.
I mainly did two things: 1. read the apk icon path and other information; 2. decompress the image under the path.
Directly go to the Code First:
The tools used are: 1. there are many apktool tools on the Internet, as well as installation tutorials. The only trouble is that the tool can only run in the java environment.
2. unzip: the http://download.csdn.net/detail/wolinxuebin/4464939 tested winrar and could not uncompress the apk, maybe because of my limited level
Here we will talk about a very important point,Exec running error
Today, my software was originally installed in E:/Program Files/GnuWin32/, so when I define it
define("UNZIP","E:/Program Files/GnuWin32/bin/unzip.exe");
However, if no result is returned during running, the exec will not report an error.
exec("{$aapt} d badging {$apk_file}",$out,$return);
Check that $ return is always 1.
This command can be fully run in the command line.
Finally, we found the directory in the commod parameter in exec,Cannot contain spaces, That is, the Program Files should be changed to ProgramFiles, so I changed the installation directory.