The bug of the read_dir method in the Zip encoding class of the Codeigniter framework. The compression and decoding class of the Codeigniter framework. the read_dir method allows you to compress a folder (as well as files and subfolders) that exists somewhere on the server ). Provides a compression and decoding class for the Codeigniter framework. the read_dir method allows you to compress a folder (as well as files and subfolders) that exists somewhere on the server ).
Provides a folder path. the zip class recursively reads it and creates it and adds it to the archive. All files under the path you provided will be compressed, including all subfolders.
For example:
$path = '/path/to/your/directory/';$this->zip->read_dir($path);
By default, the full folder path of the first parameter is saved to the Zip file. If you want to ignore the folder structure before the target path, you can pass FALSE (Boolean) to the second parameter.
For example:
$path = '/path/to/your/directory/';$this->zip->read_dir($path, false);
This will create a ZIP file including "directory". all subfolders are properly saved in it, but do not include this folder/path/to/your.
The official document only mentions two parameters. in the source code, three parameters are set:
read_dir($path, $preserve_filepath = TRUE, $root_path = NULL)
Generally, there are several methods to obtain the path within the framework runtime environment:
APPPATH-corresponds to the root directory of Codeigniter, that isapplication/
FCPATH-the root directory of the corresponding disk partition, that isD: \ xxx \ codeigniter root directory \
When you use methods such as FCPATH to obtain the absolute directory path, because the source code processes the backslash in the path, resulting in inconsistent values of $ root_path before and after, the second parameter false is invalid.
References: http://codeigniter.org.cn/user_guide/libraries/zip.html
The compression decoding class of the http://www.bkjia.com/PHPjc/363823.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/363823.htmlTechArticleCodeigniter framework, where the read_dir method allows you to compress a folder that exists somewhere on a server (and the files and subfolders in it ). Provide...