CI_Zip::add_data PHP Method

add_data() public method

Lets you add files to the archive. If the path is included in the filename it will be placed within a directory. Make sure you use add_dir() first to create the folder.
public add_data ( mixed $filepath, string $data = NULL ) : void
$filepath mixed A single filepath or an array of file => data pairs
$data string Single file contents
return void
    public function add_data($filepath, $data = NULL)
    {
        if (is_array($filepath)) {
            foreach ($filepath as $path => $data) {
                $file_data = $this->_get_mod_time($path);
                $this->_add_data($path, $data, $file_data['file_mtime'], $file_data['file_mdate']);
            }
        } else {
            $file_data = $this->_get_mod_time($filepath);
            $this->_add_data($filepath, $data, $file_data['file_mtime'], $file_data['file_mdate']);
        }
    }