Ask for a package download zip file
Every colleague of the company has to work on the work every week and then the relevant data in a table now to implement the package download function every time you read one weeks of all colleague's content each colleague's summary is a TXT file and then package all txt files into a ZIP package and then provide the download I want to know how to implement? Trouble give a bit directly to me code
------Solution--------------------
。。。。。。。。。。。。。。
Provide a way of thinking, the first to traverse the file under the directory.
Then use PHP's own ziparchive class to operate.
It's very simple.
------Solution--------------------
Here's a rough code for you.
PHP Code
Create a Zip object, and then create a compressed document Test1.zip$zip = new ziparchive (); $filename = "Test1.zip"; if ($zip->open ($filename, ziparchive: : CREATE) {!==true) {exit ("Cannot open < $filename >\n");} And then using the Brother upstairs algorithm//Traversal loop folder, get each file $filename, code slightly ...//...if ($zip->open (' test1.zip ') = = = = TRUE) {$zip->addfile ($ filename, $newname); $zip->close (); echo ' OK ';} else {echo ' failed ';}
------Solution--------------------
Ah, no words ah. Why do csdn always have those who want code directly rather than asking for ideas?
Give a man a fish, a man to a fisherman?
------Solution--------------------
$str = ' e:\\ ' program Files "\\WinRAR\\WinRAR.exe a-ep1-r-o+-m5-df zongjie.rar zongjie.txt ';
System ($STR);
------Solution--------------------
FAISUN_ZIP_V10, can achieve compression Ah, landlord can refer
------Solution--------------------
discuss
Why are there three equals signs in the code?
------Solution--------------------
That is the landlord just started not to say clearly the problem ah ...
Verify that the Php_zip.dll file is in the Ext folder in the PHP installation folder
Modify PHP.ini
Cancel the comment below
Extension=php_zip.dll
Restart Apache
As soon as you start the extension, you can use that class.
Which version of PHP is the landlord?