For the zip file on the web, a lot of examples, RAR file decompression PHP does not have direct support, you can use PECL to Http://pecl.php.net/package/rar download the corresponding version of the non-thread-safe DLL and then throw to the PHP ext directory.
Open php.ini.
Add one line
Extension=php_rar.dll
Restart the Web server and PHP
Copy Code code as follows:
Public function _unzip ($fileName, $extractTO) {
$fileName = Iconv (' u Tf-8 ', ' gb2312 ', "Upload/zip/8 month. rar");
//Echo $fileName. ' </br> ';
$extractTo = "upload/zip/test/";
$rar _file = Rar_open ($fileName) or die (' could not open rar ');
$list = rar_list ($rar _file) or die (' could not get list ');
//Print_r ($list);
foreach ($list as $file) {
$pattern = '/\ '. *\ "/";
Preg_match ($pattern, $file, $matches, preg_offset_capture);
$pathStr = $matches [0][0];
$pathStr =str_replace ("\", ", $PATHSTR);
//Print_r ($PATHSTR);
$entry = Rar_entry_get ($rar _file, $pathStr) or Die (' </br>entry not found ');
$entry->extract ($extractTo);//Extract to "Current dir
}
Rar_close ($rar _file);
}