The following describes how to use the zip class of the ci framework.
Today I am using the method of compressing folders ....
Very simple .... First, import the zip class...
The specific method is $ this-> load-> ('Zip ');
You should also set the automatic loading class to load the zip file .....
When I set it, I loaded it all .... So I didn't do this step .....
However, considering the ci structure, this step is required .... I did not verify it ....
If you encounter this problem, it may be that the zip class is not loaded automatically.
The following is the method...
| The code is as follows: |
Copy code |
|
$ Path = $ _ SERVER ['document _ root']; // path of the folder to be compressed
$ This-> zip-> read_dir ($ path, FALSE); // start compressing the folder in the specified path... Clear the structure...
$ This-> zip-> download('my_backup.zip '); // download the compressed file... |
Just a few simple operations ....
It solved the problem I thought for a few days...
Oh, mygod.