网络营销电子商务研究中心  
How to buy the best prescription safety glasses in Canada? Let's study!
Go Back   网络营销电子商务研究中心 > 网站设计 > PHP
User Name
Password
 
FAQ Members List Calendar Cheap Glasses Mark Forums Read

Reply
 
Thread Tools Display Modes
  #1   IP: 153.99.20.153
Old 2014-07-18, 11:15 AM
Alfredo Alfredo is offline
初级会员
 
Join Date: 2009-05-24
Posts: 3
Alfredo 现在声名狼藉
Default Unzip a file with php

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";
}
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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

Prescription-glasses.com offers prescription glasses online at discount prices.
All times are GMT +8. The time now is 03:43 AM.


Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.