本文整理匯總了PHP中Zip::info方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zip::info方法的具體用法?PHP Zip::info怎麽用?PHP Zip::info使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zip
的用法示例。
在下文中一共展示了Zip::info方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: index_action
/**
*
*/
public function index_action($action = 'import')
{
$this->hookAdminMenu(1);
$this->hookAdminMenu(3);
switch ($action) {
case 'import':
$form = new Form('Lang/forms/import');
if ($result = $form->result()) {
if ($file = $result->file) {
$zip = new Zip(array('file' => $file->path, 'check' => array('type' => 'lang')));
if ($zip->extract(LANG)) {
$info = $zip->info();
$langs = $this->getLangs(array($info['lang']));
success(t('<b>Архив успешно распакован!</b> Индекс для языка <b>«%s»</b> установлен.', implode($langs)), '', 'content');
}
$zip->close();
unlink($file->path);
}
}
$form->show();
break;
case 'export':
template('Lang/templates/download')->show();
break;
case 'download':
$file = ROOT . $this->prepareFilePath();
$archive = TEMP . DS . pathinfo($file, PATHINFO_FILENAME) . '.zip';
$zip = new Zip(array('file' => $archive, 'create' => TRUE));
$zip->add($file);
$zip->info(array('type' => 'lang', 'lang' => config('lang.lang')));
$zip->close();
File::download($archive, basename($archive), TRUE);
break;
}
}
示例2: download_action
/**
* Выгрузка файла конфигурации
*/
public function download_action($themes = array())
{
$archive_name = 'config.zip';
$path = TEMP . DS . $archive_name;
$zip = new Zip(array('file' => $path, 'create' => TRUE));
$zip->info(array('type' => 'config'));
$zip->add(ROOT . DS . 'config' . EXT);
$zip->close();
File::download($path, $archive_name, TRUE);
}
示例3: upload_action
/**
* Загрузка тем
*/
public function upload_action()
{
$this->hookAdminMenu();
$this->hookAdminMenu(2);
$form = new Form('Gears/forms/add');
if ($result = $form->result()) {
if ($file = $result->file ? $result->file : $result->url) {
$zip = new Zip(array('file' => UPLOADS . $file, 'check' => array('type' => 'gears')));
if ($zip->extract(GEARS)) {
$info = $zip->info();
success(t('<b>Архив успешно распакован!</b> <p>Он содержал в себе следующие шестерёнки: <ul><li>%s</li></ul>', implode('</li><li>', $info['gears'])), '', 'content');
}
$zip->close();
unlink(UPLOADS . $file);
}
}
$form->show();
}