本文整理汇总了PHP中Zip::extract方法的典型用法代码示例。如果您正苦于以下问题:PHP Zip::extract方法的具体用法?PHP Zip::extract怎么用?PHP Zip::extract使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zip
的用法示例。
在下文中一共展示了Zip::extract方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: open
/**
* Opens xlsx file
*
* @param $file
*
* @return $this
*
* @throws \Exception
*/
public function open($file)
{
if (!is_file($file)) {
throw new \Exception("File {$file} not found");
}
$dir = $this->getTempDir();
$this->zip->extract($file, $dir);
return $this;
}
示例2: tools_action
/**
* Импорт и экспорт
*/
public function tools_action()
{
$this->hookSiteSettingsMenu();
template('Admin/templates/tools')->show();
$form = new Form('Admin/forms/import');
if ($result = $form->result()) {
if ($file = $result->file) {
$zip = new Zip(array('file' => $file->path, 'check' => array('type' => 'config')));
if ($zip->extract(ROOT)) {
success(t('<b>Архив успешно распакован!</b> Новый файл конфигурации установлен.'));
}
$zip->close();
unlink($file->path);
}
}
$form->show();
}
示例3: singleBakinData
function singleBakinData($index, $pre)
{
global $bakupDir;
if (!$index) {
return false;
}
$sql = array();
$tmpname = $bakupDir . $pre . '/';
$extend = file_exists($tmpname . 'table.zip') ? 'zip' : 'sql';
$data = explode(',', $index);
$filename = $tmpname . $data[0];
if ($extend == 'zip') {
L::loadClass('zip', 'utility', false);
$zipService = new Zip();
$filename = str_replace(substr($filename, strpos($filename, '.')), '.zip', $filename);
list($tmpData) = $zipService->extract($filename);
$tmpSql = explode("\n", $tmpData['data']);
} else {
$tmpData = pwCache::readover($filename);
$tmpSql = explode("\n", $tmpData);
}
$sql = $data[2] == -1 ? array_slice($tmpSql, $data[1]) : array_slice($tmpSql, $data[1], $data[2] - $data[1]);
return doBackIn($sql);
}
示例4: 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;
}
}
示例5: download
public function download()
{
if (IS_POST) {
$module = q('get.module');
$app = Curl::get(c('api.cloud') . '?a=site/GetLastAppInfo&t=web&siteid=1&m=store&type=addons&module=' . $module);
$app = json_decode($app, TRUE);
if ($app) {
$package = Curl::post(c('api.cloud') . '?a=site/download&t=web&siteid=1&m=store&type=addons', ['file' => $app['data']['package']]);
file_put_contents('tmp.zip', $package);
//释放压缩包
Zip::PclZip('tmp.zip');
//设置压缩文件名
Zip::extract(".");
//解压缩
file_put_contents('addons/' . $module . '/cloud.hd', json_encode($app['data'], JSON_UNESCAPED_UNICODE));
message('模块下载成功,准备安装', '', 'success');
}
message('应用商店不存在模块', '', 'error');
}
View::make();
}
示例6: 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();
}