![]() |
|
|||||||
|
|
Thread Tools | Display Modes |
|
#1
IP: 153.99.20.153
|
|||
|
|||
|
the best way to extract the zip file into the same directory in which it resides is to determine the hard path to the file and extract it specifically to that location. So, you could do:
Code:
// assuming file.zip is in the same directory as the executing script.
$file = 'file.zip';
// get the absolute path to $file
$path = pathinfo(realpath($file), PATHINFO_DIRNAME);
$zip = new ZipArchive;
$res = $zip->open($file);
if ($res === TRUE) {
// extract it to the path we determined above
$zip->extractTo($path);
$zip->close();
echo "WOOT! $file extracted to $path";
} else {
echo "Doh! I couldn't open $file";
}
|
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 用php语言来编写shell脚本 | car | 代码交流 | 0 | 2008-05-05 08:09 PM |
| A PHP script to unzip files with file overwriting | topvip | 代码交流 | 0 | 2008-03-06 10:48 AM |
| Php教程.经验技巧(上) | sunshine | 代码交流 | 0 | 2006-12-15 08:13 PM |
| Php入门速成 | smiling | 代码交流 | 0 | 2006-12-15 07:30 PM |
| php.ini中文解释 | sunshine | 服务器环境搭建 | 0 | 2006-02-04 11:05 PM |