Provides various official and user-released code examples. For code reference, you are welcome to exchange and learn about a class you are using in your project. Integrated in TP, You can package local files into zip files and download them.
Usage example:
Decompress the zip package and put the extension class FileToZip. class into the ThinkPHP \ Extend \ Library \ ORG \ Util folder,
Import ('org. Util. FileToZip ');
// Package and download
$ Handler = opendir ($ cur_file); // The directory where the $ cur_file file is located
$ Download_file = array ();
$ I = 0;
While ($ filename = readdir ($ handler ))! = False ){
If ($ filename! = '.' & $ Filename! = '..'){
$ Download_file [$ I ++] = $ filename;
}
}
Closedir ($ handler );
$ Scandir = new traverseDir ($ cur_file, $ save_path); // $ save_path zip package file directory
$ Scandir-> tozip ($ download_file );
FileToZip.class.rar (1.49 KB download: 708 times)
AD: truly free, domain name + VM + enterprise mailbox = 0 RMB