PHP uploads the rar compressed package and extracts it to the directory
1. Principle of uploading and decompressing with php
Ordinary upload function Upload server
rar
zip Load system components Execute decompression command Successfully decompress to directory
7z
2.The difference between several types of functions used by php to execute system commands
system() outputs and returns the last line of shell results
exec() does not output results and returns the last line of shell results
passthru() only calls the command and outputs the running results as is
new com() The system predefines the com class, and you can choose any built-in method according to your needs
3. Use php predefined com component to load the shell
$obj=new com('wscript.shell'); component that loads wscript.shell to execute dos commands
$obj->run('Content of the command to be executed');
rar decompression command: winrar x decompressed file decompression location
4. Example operation php upload and decompression case
Get the current absolute path getcwd();
Upload moved file function move_uploaded_file();
This article comes from the “r0otkit” blog