本文整理汇总了PHP中Zip::addContent方法的典型用法代码示例。如果您正苦于以下问题:PHP Zip::addContent方法的具体用法?PHP Zip::addContent怎么用?PHP Zip::addContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zip
的用法示例。
在下文中一共展示了Zip::addContent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: export
public function export()
{
$condition['project_id'] = Request::input('project_id');
//todo
$projectName = 'catphp';
$fields = array('name', '_id', 'content');
$rs = $this->mongo->find('document', $condition, array('sort' => array('sort' => 1)), $fields);
$mk = new Parsedown();
$docs = array();
foreach ($rs as $row) {
$doc = array();
$doc['name'] = $row['name'];
$doc['content'] = $mk->parse($row['content']);
$docs[] = $doc;
}
$this->assign("docs", $docs);
$content = $this->render('views/document.html', false);
// $this->staticize('runtime/index.html');
$download_config = CatConfig::getInstance(APP_PATH . '/config/download.conf.php');
$download_zip_name = APP_PATH . '/runtime/' . $projectName . date('YmdHis') . '.zip';
$zip = new Zip($download_zip_name, ZipArchive::OVERWRITE);
$zip->addContent($content, 'index.html');
foreach ($download_config->get('default') as $file) {
$zip->addFile(APP_PATH . '/runtime/' . $file, $file);
}
$zip->close();
$this->download($download_zip_name, $projectName . '.zip');
// $this->zip($this->render('views/document.html'));
// var_dump($download_config->get('default'));
}