• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP zip_open函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中zip_open函数的典型用法代码示例。如果您正苦于以下问题:PHP zip_open函数的具体用法?PHP zip_open怎么用?PHP zip_open使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了zip_open函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: getItems

 /**
  * Method to get an array of data items.
  *
  * @return  array  An array of data items
  *
  * @since   12.2
  */
 public function getItems()
 {
     jimport('joomla.filesystem.folder');
     $items = array();
     $files = JFolder::files(JDeveloperArchive::getArchiveDir());
     $store = $this->getStoreId('getItems');
     foreach ($files as $file) {
         if (preg_match('/(^pkg_).*(.zip$)/', $file)) {
             $item = new JObject();
             $item->set('id', $file);
             $item->set('name', $file);
             $item->set('created', date("Y M d - H:i:s", filemtime(JDeveloperArchive::getArchiveDir() . DS . $file)));
             $item->createDir = JDeveloperArchive::getArchiveDir() . "/" . JDeveloperArchive::getArchiveName("pkg_", $item->name, $item->get("version", "1.0.0"));
             $content = array();
             if (!($zip = zip_open(JDeveloperArchive::getArchiveDir() . DS . $file))) {
                 throw new Exception("Failed to open {$file}");
             }
             while ($zip_entry = zip_read($zip)) {
                 if (preg_match('/.zip$/', zip_entry_name($zip_entry))) {
                     $content[] = zip_entry_name($zip_entry);
                 }
             }
             $item->set('content', implode('<br>', $content));
             $items[] = $item;
         }
     }
     // Add the items to the internal cache.
     $this->cache['packages'] = $items;
     return $this->cache['packages'];
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:37,代码来源:packages.php


示例2: extractFiles

 /**
  * Extract the QTI files.
  *
  *
  * @param UJM\ExoBundle\Services\classes\QTI $qtiRepo
  *
  * @return bool
  */
 private function extractFiles($qtiRepo)
 {
     $request = $this->container->get('request');
     $file = $request->files->get('qtifile');
     $qtiRepo->createDirQTI();
     $root = [];
     $fichier = [];
     $file->move($qtiRepo->getUserDir(), $file->getClientOriginalName());
     $zip = new \ZipArchive();
     if ($zip->open($qtiRepo->getUserDir() . $file->getClientOriginalName()) !== true) {
         return false;
     }
     $res = zip_open($qtiRepo->getUserDir() . $file->getClientOriginalName());
     $zip->extractTo($qtiRepo->getUserDir());
     $i = 0;
     while ($zip_entry = zip_read($res)) {
         if (zip_entry_filesize($zip_entry) > 0) {
             $nom_fichier = zip_entry_name($zip_entry);
             if (substr($nom_fichier, -4, 4) === '.xml') {
                 $root[$i] = $fichier = explode('/', $nom_fichier);
             }
         }
         ++$i;
     }
     $zip->close();
     return true;
 }
开发者ID:claroline,项目名称:distribution,代码行数:35,代码来源:QtiController.php


示例3: extract_zip

 function extract_zip($zipfile, $dir)
 {
     if (function_exists('zip_open')) {
         $zip = zip_open($zipfile);
         if ($zip) {
             while ($zip_entry = zip_read($zip)) {
                 if (zip_entry_filesize($zip_entry) > 0) {
                     if (zip_entry_open($zip, $zip_entry, "r")) {
                         $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
                         zip_entry_close($zip_entry);
                         file_put($dir . '/' . zip_entry_name($zip_entry), $buf);
                     }
                 } else {
                     dir_create($dir . '/' . zip_entry_name($zip_entry));
                 }
             }
             zip_close($zip);
         }
     } else {
         $array = $this->list_zip($zipfile);
         $count = count($array);
         $f = 0;
         $d = 0;
         for ($i = 0; $i < $count; $i++) {
             if ($array[$i]['folder'] == 0) {
                 if ($this->extract_file($zipfile, $dir, $i) > 0) {
                     $f++;
                 }
             } else {
                 $d++;
             }
         }
     }
     return true;
 }
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:35,代码来源:unzip.class.php


示例4: testConversion

 /**
  * Test if the Epub conversion works correctly
  *
  * @return void
  */
 public function testConversion()
 {
     $this->epub->setInputFile($this->testInputFile);
     $this->epub->setOutputFile($this->testOutputFile);
     $this->epub->convert();
     $this->assertTrue($this->epub->getStatus());
     $this->assertNotSame(file_get_contents($this->testInputFile), file_get_contents($this->testOutputFile));
     $finfo = finfo_open(FILEINFO_MIME_TYPE);
     $mimeType = finfo_file($finfo, $this->testOutputFile);
     $this->assertSame($mimeType, 'application/epub+zip');
     $epubZip = zip_open($this->testOutputFile);
     $this->assertTrue(is_resource($epubZip));
     $foundContent = false;
     $foundGraphics = false;
     while ($zipDir = zip_read($epubZip)) {
         $zipDirName = zip_entry_name($zipDir);
         if ($zipDirName == $this->expectedContentFile) {
             $foundContent = true;
         }
         if (strpos($zipDirName, $this->expectedGraphicsDir)) {
             $foundGraphics = true;
         }
     }
     zip_close($epubZip);
     $this->assertTrue($foundContent);
     $this->assertTrue($foundGraphics);
 }
开发者ID:anukat2015,项目名称:xmlps,代码行数:32,代码来源:EpubGraphicsTest.php


示例5: unpackZip

function unpackZip($file, $dir)
{
    if ($zip = zip_open(getcwd() . $file)) {
        if ($zip) {
            while ($zip_entry = zip_read($zip)) {
                if (zip_entry_open($zip, $zip_entry, "r")) {
                    $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
                    $dir_name = dirname(zip_entry_name($zip_entry));
                    if ($dir_name == "." || !is_dir($dir_name)) {
                        $dir_op = $dir;
                        foreach (explode("/", $dir_name) as $k) {
                            $dir_op = $dir_op . $k;
                            if (is_file($dir_op)) {
                                unlink($dir_op);
                            }
                            if (!is_dir($dir_op)) {
                                mkdir($dir_op);
                            }
                            $dir_op = $dir_op . "/";
                        }
                    }
                    $fp = fopen($dir . zip_entry_name($zip_entry), "w");
                    fwrite($fp, $buf);
                    zip_entry_close($zip_entry);
                } else {
                    return false;
                }
            }
            zip_close($zip);
        }
    } else {
        return false;
    }
    return true;
}
开发者ID:mamogmx,项目名称:praticaweb-alghero,代码行数:35,代码来源:stp.crea_doc.php


示例6: odt_unzip

 public function odt_unzip($file, $save = false)
 {
     if (!function_exists('zip_open')) {
         die('NO ZIP FUNCTIONS DETECTED. Do you have the PECL ZIP extensions loaded?');
     }
     if ($zip = zip_open($file)) {
         while ($zip_entry = zip_read($zip)) {
             $filename = zip_entry_name($zip_entry);
             if (zip_entry_name($zip_entry) == 'content.xml' and zip_entry_open($zip, $zip_entry, "r")) {
                 $content = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
                 zip_entry_close($zip_entry);
             }
             if (preg_match('Pictures/', $filename) and !preg_match('Object', $filename) and zip_entry_open($zip, $zip_entry, "r")) {
                 $img[$filename] = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
                 zip_entry_close($zip_entry);
             }
         }
         if (isset($content)) {
             if ($save == false) {
                 return array($content, $img);
             } else {
                 file_put_contents('content.xml', $content);
                 if (is_array($img)) {
                     if (!is_dir('Pictures')) {
                         mkdir('Pictures');
                     }
                     foreach ($img as $key => $val) {
                         file_put_contents($key, $val);
                     }
                 }
             }
         }
     }
 }
开发者ID:hackersforcharity,项目名称:rachelpiOS,代码行数:34,代码来源:odt_reader.php


示例7: unzip

function unzip($file)
{
    $zip = zip_open($file);
    if (is_resource($zip)) {
        $tree = "";
        while (($zip_entry = zip_read($zip)) !== false) {
            echo "Unpacking " . zip_entry_name($zip_entry) . "\n";
            if (strpos(zip_entry_name($zip_entry), DIRECTORY_SEPARATOR) !== false) {
                $last = strrpos(zip_entry_name($zip_entry), DIRECTORY_SEPARATOR);
                $dir = substr(zip_entry_name($zip_entry), 0, $last);
                $file = substr(zip_entry_name($zip_entry), strrpos(zip_entry_name($zip_entry), DIRECTORY_SEPARATOR) + 1);
                if (!is_dir($dir)) {
                    @mkdir($dir, 0755, true) or die("Unable to create {$dir}\n");
                }
                if (strlen(trim($file)) > 0) {
                    $return = @file_put_contents($dir . "/" . $file, zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)));
                    if ($return === false) {
                        die("Unable to write file {$dir}/{$file}\n");
                    }
                }
            } else {
                file_put_contents($file, zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)));
            }
        }
    } else {
        echo "Unable to open zip file\n";
    }
}
开发者ID:ankuradhey,项目名称:dealtrip,代码行数:28,代码来源:general.php


示例8: unzip

 public static function unzip($file, $dir)
 {
     $zip = new ZipArchive();
     $zip->open($file);
     $zip->extractTo($dir);
     return;
     $zip = zip_open($file);
     if (!is_resource($zip)) {
         return $zip;
     }
     while ($zipEntry = zip_read($zip)) {
         $name = zip_entry_name($zipEntry);
         $size = zip_entry_filesize($zipEntry);
         $data = zip_entry_read($zipEntry, $size);
         if (substr($name, -1, 1) == "/") {
             if (!is_dir($dir . "/" . $name)) {
                 mkdir($dir . "/" . $name);
             }
         } else {
             $filename = $dir . "/" . $name;
             if (!is_file($filename) || md5(file_get_contents($filename)) != md5($data)) {
                 file_put_contents($filename, $data);
             }
         }
     }
     return true;
 }
开发者ID:robjcordes,项目名称:nexnewwp,代码行数:27,代码来源:Manager.php


示例9: unzip

 function unzip($file, $dir = 'unzip/')
 {
     if (!file_exists($dir)) {
         mkdir($dir, 0777);
     }
     $zip_handle = zip_open($file);
     if (is_resource($zip_handle)) {
         while ($zip_entry = zip_read($zip_handle)) {
             if ($zip_entry) {
                 $zip_name = zip_entry_name($zip_entry);
                 $zip_size = zip_entry_filesize($zip_entry);
                 if ($zip_size == 0 && $zip_name[strlen($zip_name) - 1] == '/') {
                     mkdir($dir . $zip_name, 0775);
                 } else {
                     @zip_entry_open($zip_handle, $zip_entry, 'r');
                     $fp = @fopen($dir . $zip_name, 'wb+');
                     @fwrite($fp, zip_entry_read($zip_entry, $zip_size), $zip_size);
                     @fclose($fp);
                     @chmod($dir . $zip_name, 0775);
                     @zip_entry_close($zip_entry);
                 }
             }
         }
         return true;
     } else {
         zip_close($zip_handle);
         return false;
     }
 }
开发者ID:vladimir-g,项目名称:rulinux-engine,代码行数:29,代码来源:admin.class.php


示例10: unzip

function unzip($zipfile)
{
    $zip = zip_open($zipfile);
    while ($zip_entry = zip_read($zip)) {
        zip_entry_open($zip, $zip_entry);
        if (substr(zip_entry_name($zip_entry), -1) == '/') {
            $zdir = substr(zip_entry_name($zip_entry), 0, -1);
            if (file_exists($zdir)) {
                trigger_error('Directory "<b>' . $zdir . '</b>" exists', E_USER_ERROR);
                return false;
            }
            mkdir($zdir);
        } else {
            $name = zip_entry_name($zip_entry);
            if (file_exists($name)) {
                trigger_error('File "<b>' . $name . '</b>" exists', E_USER_ERROR);
                return false;
            }
            $fopen = fopen($name, "w");
            fwrite($fopen, zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)), zip_entry_filesize($zip_entry));
        }
        zip_entry_close($zip_entry);
    }
    zip_close($zip);
    return true;
}
开发者ID:lotcz,项目名称:zshop,代码行数:26,代码来源:zip.php


示例11: importAction

 /**
  * This action handles import action.
  *
  * It must be reached by a POST request.
  *
  * Parameter is:
  *   - file (default: nothing!)
  * Available file types are: zip, json or xml.
  */
 public function importAction()
 {
     if (!Minz_Request::isPost()) {
         Minz_Request::forward(array('c' => 'importExport', 'a' => 'index'), true);
     }
     $file = $_FILES['file'];
     $status_file = $file['error'];
     if ($status_file !== 0) {
         Minz_Log::error('File cannot be uploaded. Error code: ' . $status_file);
         Minz_Request::bad(_t('feedback.import_export.file_cannot_be_uploaded'), array('c' => 'importExport', 'a' => 'index'));
     }
     @set_time_limit(300);
     $type_file = $this->guessFileType($file['name']);
     $list_files = array('opml' => array(), 'json_starred' => array(), 'json_feed' => array());
     // We try to list all files according to their type
     $list = array();
     if ($type_file === 'zip' && extension_loaded('zip')) {
         $zip = zip_open($file['tmp_name']);
         if (!is_resource($zip)) {
             // zip_open cannot open file: something is wrong
             Minz_Log::error('Zip archive cannot be imported. Error code: ' . $zip);
             Minz_Request::bad(_t('feedback.import_export.zip_error'), array('c' => 'importExport', 'a' => 'index'));
         }
         while (($zipfile = zip_read($zip)) !== false) {
             if (!is_resource($zipfile)) {
                 // zip_entry() can also return an error code!
                 Minz_Log::error('Zip file cannot be imported. Error code: ' . $zipfile);
             } else {
                 $type_zipfile = $this->guessFileType(zip_entry_name($zipfile));
                 if ($type_file !== 'unknown') {
                     $list_files[$type_zipfile][] = zip_entry_read($zipfile, zip_entry_filesize($zipfile));
                 }
             }
         }
         zip_close($zip);
     } elseif ($type_file === 'zip') {
         // Zip extension is not loaded
         Minz_Request::bad(_t('feedback.import_export.no_zip_extension'), array('c' => 'importExport', 'a' => 'index'));
     } elseif ($type_file !== 'unknown') {
         $list_files[$type_file][] = file_get_contents($file['tmp_name']);
     }
     // Import file contents.
     // OPML first(so categories and feeds are imported)
     // Starred articles then so the "favourite" status is already set
     // And finally all other files.
     $error = false;
     foreach ($list_files['opml'] as $opml_file) {
         $error = $this->importOpml($opml_file);
     }
     foreach ($list_files['json_starred'] as $article_file) {
         $error = $this->importJson($article_file, true);
     }
     foreach ($list_files['json_feed'] as $article_file) {
         $error = $this->importJson($article_file);
     }
     // And finally, we get import status and redirect to the home page
     Minz_Session::_param('actualize_feeds', true);
     $content_notif = $error === true ? _t('feedback.import_export.feeds_imported_with_errors') : _t('feedback.import_export.feeds_imported');
     Minz_Request::good($content_notif);
 }
开发者ID:krisfremen,项目名称:FreshRSS,代码行数:69,代码来源:importExportController.php


示例12: parse

 public static function parse($filename)
 {
     $striped_content = '';
     $content = '';
     if (!$filename || !file_exists($filename)) {
         return false;
     }
     $zip = zip_open($filename);
     if (!$zip || is_numeric($zip)) {
         return false;
     }
     while ($zip_entry = zip_read($zip)) {
         if (zip_entry_open($zip, $zip_entry) == FALSE) {
             continue;
         }
         if (zip_entry_name($zip_entry) != "content.xml") {
             continue;
         }
         $content .= zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
         zip_entry_close($zip_entry);
     }
     zip_close($zip);
     $content = str_replace('</w:r></w:p></w:tc><w:tc>', " ", $content);
     $content = str_replace('</w:r></w:p>', "\r\n", $content);
     $striped_content = strip_tags($content);
     return $striped_content;
 }
开发者ID:ellak-monades-aristeias,项目名称:wp-file-search,代码行数:27,代码来源:odt.php


示例13: getZipHeaderFilepointer

function getZipHeaderFilepointer($filename, &$MP3fileInfo)
{
    if (!function_exists('zip_open')) {
        $MP3fileInfo['error'] = "\n" . 'Zip functions not available (requires at least PHP 4.0.7RC1 and ZZipLib (http://zziplib.sourceforge.net/) - see http://www.php.net/manual/en/ref.zip.php)';
        return FALSE;
    } else {
        if ($zip = zip_open($filename)) {
            $zipentrycounter = 0;
            while ($zip_entry = zip_read($zip)) {
                $MP3fileInfo['zip']['entries']["{$zipentrycounter}"]['name'] = zip_entry_name($zip_entry);
                $MP3fileInfo['zip']['entries']["{$zipentrycounter}"]['filesize'] = zip_entry_filesize($zip_entry);
                $MP3fileInfo['zip']['entries']["{$zipentrycounter}"]['compressedsize'] = zip_entry_compressedsize($zip_entry);
                $MP3fileInfo['zip']['entries']["{$zipentrycounter}"]['compressionmethod'] = zip_entry_compressionmethod($zip_entry);
                //if (zip_entry_open($zip, $zip_entry, "r")) {
                //	$MP3fileInfo['zip']['entries']["$zipentrycounter"]['contents'] = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
                //	zip_entry_close($zip_entry);
                //}
                $zipentrycounter++;
            }
            zip_close($zip);
            return TRUE;
        } else {
            $MP3fileInfo['error'] = "\n" . 'Could not open file';
            return FALSE;
        }
    }
}
开发者ID:jiminald,项目名称:PHP-Multimedia-Sorter,代码行数:27,代码来源:getid3.zip.php


示例14: GenerateInfos

 function GenerateInfos()
 {
     $zip = zip_open($this->zipFile);
     $folder_count = 0;
     $file_count = 0;
     $unzipped_size = 0;
     $ext_array = array();
     $ext_count = array();
     //$entries_list      = array ();
     $entries_name = array();
     if ($zip) {
         while ($zip_entry = zip_read($zip)) {
             $zip_entry_name = zip_entry_name($zip_entry);
             if (is_dir($zip_entry_name)) {
                 $folder_count++;
             } else {
                 //$entries_list[]=$zip_entry;
                 $entries_name[] = $zip_entry_name;
                 $file_count++;
             }
             $path_parts = pathinfo(zip_entry_name($zip_entry));
             $ext = strtolower(trim(isset($path_parts['extension']) ? $path_parts['extension'] : ''));
             if ($ext != '') {
                 $ext_count[$ext]['count'] = isset($ext_count[$ext]['count']) ? $ext_count[$ext]['count'] : 0;
                 $ext_count[$ext]['count']++;
             }
             $unzipped_size = $unzipped_size + zip_entry_filesize($zip_entry);
         }
     }
     $zipped_size = $this->get_file_size_unit(filesize($this->zipFile));
     $unzipped_size = $this->get_file_size_unit($unzipped_size);
     $zip_info = array("folders" => $folder_count, "files" => $file_count, "zipped_size" => $zipped_size, "unzipped_size" => $unzipped_size, "file_types" => $ext_count, "entries_name" => $entries_name);
     zip_close($zip);
     return $zip_info;
 }
开发者ID:roly445,项目名称:Php-Nuget-Server,代码行数:35,代码来源:zipmanager.php


示例15: getLayoutData

function getLayoutData($layout, $fileName, $usage, $install = false)
{
    $output = "";
    $zip = zip_open(($install == false ? 'layouts/' : '../layouts/') . $layout . '.zip');
    if ($zip) {
        while ($zip_entry = zip_read($zip)) {
            $file = basename(zip_entry_name($zip_entry));
            if (zip_entry_open($zip, $zip_entry, 'r')) {
                if ($usage == "include" && strpos($file, $fileName) !== FALSE) {
                    $output = 'phar://layouts/' . $layout . '.zip/' . zip_entry_name($zip_entry);
                }
                if ($usage == "echo") {
                    $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
                    if (strpos(strval($file), strval($fileName)) !== FALSE) {
                        if (strpos($file, 'settings') !== FALSE) {
                            $output = json_decode($buf, true);
                        } else {
                            $output = $buf;
                        }
                    }
                }
            }
        }
        zip_close($zip);
    }
    return $output;
}
开发者ID:Rydog101,项目名称:MyMods,代码行数:27,代码来源:functions.php


示例16: read_docx

 private function read_docx()
 {
     $striped_content = '';
     $content = '';
     $zip = zip_open($this->filename);
     if (!$zip || is_numeric($zip)) {
         return false;
     }
     while ($zip_entry = zip_read($zip)) {
         if (zip_entry_open($zip, $zip_entry) == FALSE) {
             continue;
         }
         if (zip_entry_name($zip_entry) != "word/document.xml") {
             continue;
         }
         $content .= zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
         zip_entry_close($zip_entry);
     }
     // end while
     zip_close($zip);
     $content = str_replace('</w:r></w:p></w:tc><w:tc>', " ", $content);
     $content = str_replace('</w:r></w:p>', "\r\n", $content);
     $striped_content = strip_tags($content);
     return $striped_content;
 }
开发者ID:roman1970,项目名称:lis,代码行数:25,代码来源:DocxConverter.php


示例17: read_file_docx

 public function read_file_docx($filename)
 {
     $striped_content = '';
     $content = '';
     if (!$filename || !file_exists($filename)) {
         return false;
     }
     $zip = zip_open($filename);
     if (!$zip || is_numeric($zip)) {
         return false;
     }
     while ($zip_entry = zip_read($zip)) {
         if (zip_entry_open($zip, $zip_entry) == FALSE) {
             continue;
         }
         if (zip_entry_name($zip_entry) != "word/document.xml") {
             continue;
         }
         $content .= zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
         zip_entry_close($zip_entry);
     }
     // end while
     zip_close($zip);
     //echo $content;
     //echo "<hr>";
     //file_put_contents('1.xml', $content);
     $content = str_replace('</w:r></w:p></w:tc><w:tc>', " ", $content);
     $content = str_replace('</w:r></w:p>', "\r\n", $content);
     $striped_content = strip_tags($content);
     return $striped_content;
 }
开发者ID:einnor,项目名称:mailroom,代码行数:31,代码来源:docxreader.php


示例18: open

 private function open()
 {
     $this->resource = zip_open($this->filepath);
     if (!$this->resource) {
         throw new SException("Zip file {$this->filepath} does not exist");
     }
 }
开发者ID:BackupTheBerlios,项目名称:stato-svn,代码行数:7,代码来源:zip.php


示例19: extract

 function extract($file, $addon_name)
 {
     global $config;
     $unzipped = FALSE;
     $zip = zip_open($file);
     if (is_resource($zip)) {
         while ($zip_entry = zip_read($zip)) {
             $path_parts = pathinfo($config['basepath'] . "/addons/" . $addon_name . '/' . zip_entry_name($zip_entry));
             //echo'<pre>'.print_r($path_parts,true).'</pre>';
             if (!isset($path_parts['extension']) && !file_exists($config['basepath'] . "/addons/" . $addon_name . '/' . zip_entry_name($zip_entry))) {
                 mkdir($config['basepath'] . "/addons/" . $addon_name . '/' . zip_entry_name($zip_entry));
             }
             if (!is_dir($config['basepath'] . "/addons/" . $addon_name . '/' . zip_entry_name($zip_entry))) {
                 $fp = fopen($config['basepath'] . "/addons/" . $addon_name . '/' . zip_entry_name($zip_entry), "w");
                 $unzipped = TRUE;
                 if (zip_entry_open($zip, $zip_entry, "r")) {
                     $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
                     fwrite($fp, "{$buf}");
                     zip_entry_close($zip_entry);
                     fclose($fp);
                 }
             }
         }
         zip_close($zip);
         return TRUE;
     }
     return FALSE;
 }
开发者ID:henryhe514,项目名称:ChineseCommercial,代码行数:28,代码来源:addon_manager.inc.php


示例20: load_sheet

 function load_sheet($sheet_index)
 {
     $this->zip = zip_open($this->xlsx);
     if ($this->zip) {
         while ($zip_entry = zip_read($this->zip)) {
             if (zip_entry_name($zip_entry) == 'xl/worksheets/sheet' . $sheet_index . '.xml') {
                 // 실제 로드되는 파일
                 if (zip_entry_open($this->zip, $zip_entry, "r")) {
                     $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
                     $arr = simplexml_load_string($buf);
                     $this->rows =& $arr->sheetData->row;
                     $this->rowsize = sizeof($this->rows);
                     // dimension 을 파싱해서 써도 되지만 구찬아서.;
                     if ($this->rowsize > 0) {
                         $this->colsize = (int) array_pop(explode(":", (string) $this->rows[0]['spans']));
                         // 1:7 이런식으로 값이 들어있음.
                     } else {
                         $this->colsize = 0;
                     }
                     zip_entry_close($zip_entry);
                 }
                 // if
             }
         }
         // while
     }
     // if this zip
 }
开发者ID:akswosn,项目名称:Smartax,代码行数:28,代码来源:ohjicXlsxReader.php



注:本文中的zip_open函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP zip_read函数代码示例发布时间:2022-05-23
下一篇:
PHP zip_files函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap