PHP compressed folder Specific implementation Method _php tutorial

Source: Internet
Author: User

However, there are no functions for folder operations in the Zlib library (of course, we can write one ourselves, but it is too cumbersome), we can go online to download some of the ready-made, written by our predecessors, expanded the Zlib function library tools.

PHP compressed folder specific implementation code:

  1. < ? PHP
  2. Require_once ("archive.php");
  3. $ Test = New zip_file ("App.zip");
  4. $test- > Set_options (
  5. Array
  6. ' basedir ' = > dirname ($modpath),
  7. ' inmemory ' = > 0,//not in memory compression.
    Instead, it is stored directly on the disk. If you want to compress the download, you can choose to 1
  8. ' recurse ' = > 1,//whether to compress sub-directories,
    Resurse, the meaning of recursion?
  9. ' storepaths ' = > 1,//Whether the directory structure is stored, I choose Yes.
  10. ' Overwrite ' = > 1,//whether to overwrite
  11. ' prepend ' = > " ",//Unknown
  12. ' followlinks ' = > 0,//unknown
  13. ' method ' = > 1,//unknown
  14. ' SFX ' = > " ",//Don't know what it means
  15. )
  16. );
  17. $test- > add_files ("src/archive.php");
  18. $test- > add_files ("/app");
  19. $test- > create_archive ();
  20. $test- > Download_file ();
    Do not write this line, the data only exists in memory
  21. The following code is the decompression
  22. $ Test = New tar_file ("Archives/test.tar");
  23. $test- > set_options (Array (' inmemory ' => 0));
  24. $test- > extract_files ();
  25. ?>

I hope that this code example described in this article can help us to further understand the meaning of the PHP compressed folder.


http://www.bkjia.com/PHPjc/446142.html www.bkjia.com true http://www.bkjia.com/PHPjc/446142.html techarticle However, there are no functions for folder operation in the Zlib library (of course, we can write one ourselves, but this is too much trouble), we can go online to download some off-the-shelf, written by our predecessors ...

  • 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.