Please implement package upload zip file

Source: Internet
Author: User
Tags ziparchive
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?


  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.