Vam*_*a B 2 php zip loops codeigniter
继承人我现在的表现如何:
$path = "./uploads/1.txt";
$path1 = "./uploads/4.txt";
$this->zip->read_file($path);
$this->zip->read_file($path1);
$this->zip->download('files_backup.zip');
Run Code Online (Sandbox Code Playgroud)
现在我想从数据库查询中添加文件,返回文件的路径.
$data['query'] = $this->db->get_where('files', array('uid'=>$uid));
Run Code Online (Sandbox Code Playgroud)
现在请告诉我必须使用哪个循环才能打电话 $this->zip->read_file($path);
从上面提到的查询结果..
谢谢
编辑:
foreach ($query->result() as $row)
{
echo $row->filename;
}
Run Code Online (Sandbox Code Playgroud)
结果
335476sfsr.txt
egyafhwe7g.txt
4566weyt36.txt
Run Code Online (Sandbox Code Playgroud)
所以,它只显示该用户的文件..
好的,那么就这样编辑给定的循环
foreach ($query->result() as $row)
{
$this->zip->read_file($row->filename);
}
$this->zip->download('files_backup.zip');
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7174 次 |
| 最近记录: |