/** * 导出压缩包 * */ public function exportAction() { $alias = $this->getInput('alias', 'get'); Wind::import('LIB:utility.PwZip'); $dir = Wind::getRealDir('EXT:' . $alias); if (!is_dir($dir)) { $this->showError('fail'); } $target = Wind::getRealPath('DATA:tmp.' . $alias . '.zip', true); PwApplicationHelper::zip($dir, $target); $timestamp = Pw::getTime(); $this->getResponse()->setHeader('Last-Modified', gmdate('D, d M Y H:i:s', $timestamp + 86400) . ' GMT'); $this->getResponse()->setHeader('Expires', gmdate('D, d M Y H:i:s', $timestamp + 86400) . ' GMT'); $this->getResponse()->setHeader('Cache-control', 'max-age=86400'); $this->getResponse()->setHeader('Content-type', 'application/x-zip-compressed'); $this->getResponse()->setHeader('Content-Disposition', 'attachment; filename=' . $alias . '.zip'); $this->getResponse()->sendHeaders(); @readfile($target); WindFile::del($target); $this->getResponse()->sendBody(); exit; }
/** * 导出压缩包 * */ public function exportAction() { list($type, $alias) = $this->getInput(array('type', 'alias'), 'get'); $conf = Wekit::load('APPCENTER:service.srv.PwInstallApplication')->getConfig('style-type', $type); if (!$conf) { $this->showMessage('fail'); } Wind::import('LIB:utility.PwZip'); $dir = Wind::getRealDir('THEMES:') . DIRECTORY_SEPARATOR . $conf[1] . DIRECTORY_SEPARATOR . $alias; if (!is_dir($dir)) { $this->showError('fail'); } $target = Wind::getRealPath('DATA:tmp.' . $alias . '.zip', true); PwApplicationHelper::zip($dir, $target); $this->getResponse()->setHeader('Content-type', 'application/x-zip-compressed'); $this->getResponse()->setHeader('Content-Disposition', 'attachment; filename=' . $alias . '.zip'); $this->getResponse()->setHeader('Expires', '0'); $this->getResponse()->sendHeaders(); readfile($target); WindFile::del($target); $this->getResponse()->sendBody(); exit; }