当前位置: 首页>>代码示例>>PHP>>正文


PHP gzrewind函数代码示例

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


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

示例1: _rewind

 function _rewind()
 {
     if (is_resource($this->_file)) {
         if ($this->_compress_type == 'gz') {
             @gzrewind($this->_file);
         } else {
             if ($this->_compress_type == 'bz2') {
                 // ----- Replace missing bztell() and bzseek()
             } else {
                 if ($this->_compress_type == 'none') {
                     @rewind($this->_file);
                 } else {
                     $this->_error('Unknown or missing compression type (' . $this->_compress_type . ')');
                 }
             }
         }
     }
     return true;
 }
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:19,代码来源:durabletar.class.php

示例2: gzopen

<?php

$filename = "gzread_variation1.txt.gz";
$h = gzopen($filename, 'w');
$str = "Here is the string to be written. ";
var_dump(gzread($h, 100));
gzwrite($h, $str);
var_dump(gzread($h, 100));
gzrewind($h);
var_dump(gzread($h, 100));
gzclose($h);
$h = gzopen($filename, 'r');
gzpassthru($h);
gzclose($h);
echo "\n";
unlink($filename);
?>
===DONE===
开发者ID:badlamer,项目名称:hhvm,代码行数:18,代码来源:gzread_variation1.php

示例3: doRewind

 function doRewind()
 {
     return @gzrewind($this->File);
 }
开发者ID:legende91,项目名称:ez,代码行数:4,代码来源:ezgzipshellcompressionhandler.php

示例4: dirname

<?php

$f = dirname(__FILE__) . "/004.txt.gz";
$h = gzopen($f, 'r');
$extra_arg = 'nothing';
var_dump(gzrewind($h, $extra_arg));
var_dump(gzrewind());
gzclose($h);
?>
===DONE===
开发者ID:badlamer,项目名称:hhvm,代码行数:10,代码来源:gzrewind_error.php

示例5: _write

 /**
  * Write the sitemap into a file
  *
  * @access  protected
  * @param   string     $filename the name of the sitemap file
  * @param   string     $sitemap  the content of the sitemap
  * @return  boolean              TRUE = success, FALSE = otherwise
  */
 function _write($filename, $sitemap)
 {
     $retval = FALSE;
     if (!@touch($filename)) {
         COM_errorLog(__CLASS__ . ': Cannot write the sitemap file: ' . $filename);
         return $retval;
     }
     // If file name is '*.gz', then we use gz* functions
     $parts = pathinfo($filename);
     if (isset($parts['extension']) and strtolower($parts['extension']) == 'gz' and is_callable('gzopen')) {
         // Save as a gzipped file
         $gp = gzopen($filename, 'r+b');
         if ($gp === FALSE) {
             COM_errorLog(__CLASS__ . ': Cannot create the sitemap file: ' . $filename);
         } else {
             if (flock($gp, LOCK_EX)) {
                 ftruncate($gp, 0);
                 gzrewind($gp);
                 gzwrite($gp, $sitemap);
                 gzclose($gp);
                 $retval = TRUE;
             } else {
                 COM_errorLog(__CLASS__ . ': Cannot lock the sitemap file for writing: ' . $filename);
             }
         }
     } else {
         $fp = fopen($filename, 'r+b');
         if ($fp === FALSE) {
             COM_errorLog(__CLASS__ . ': Cannot create the sitemap file: ' . $filename);
         } else {
             if (flock($fp, LOCK_EX)) {
                 ftruncate($fp, 0);
                 rewind($fp);
                 fwrite($fp, $sitemap);
                 fclose($fp);
                 $retval = TRUE;
             } else {
                 COM_errorLog(__CLASS__ . ': Cannot lock the sitemap file for writing: ' . $filename);
             }
         }
     }
     return $retval;
 }
开发者ID:hostellerie,项目名称:nexpro,代码行数:51,代码来源:xmlsitemap.class.php

示例6: write

 /**
  * Write a sitemap into a file
  *
  * @param   string     $filename the name of the sitemap file
  * @param   string     $sitemap  the content of the sitemap
  * @return  boolean              true = success, false = otherwise
  */
 protected function write($filename, $sitemap)
 {
     $retval = false;
     if (!@touch($filename)) {
         COM_errorLog(__METHOD__ . ': Cannot write into the sitemap file: ' . $filename);
         return $retval;
     }
     // If file name is '*.gz', then we use Zlib functions
     $parts = pathinfo($filename);
     if (isset($parts['extension']) && strtolower($parts['extension']) === 'gz' && is_callable('gzopen')) {
         // Save as a gzipped file
         $gp = @gzopen($filename, 'r+b');
         if ($gp === false) {
             COM_errorLog(__METHOD__ . ': Cannot create the sitemap file: ' . $filename);
         } else {
             if (flock($gp, LOCK_EX)) {
                 ftruncate($gp, 0);
                 gzrewind($gp);
                 gzwrite($gp, $sitemap);
                 flock($gp, LOCK_UN);
                 gzclose($gp);
                 $retval = true;
             } else {
                 COM_errorLog(__METHOD__ . ': Cannot lock the sitemap file for writing: ' . $filename);
             }
         }
     } else {
         $fp = @fopen($filename, 'r+b');
         if ($fp === false) {
             COM_errorLog(__METHOD__ . ': Cannot create the sitemap file: ' . $filename);
         } else {
             if (flock($fp, LOCK_EX)) {
                 ftruncate($fp, 0);
                 rewind($fp);
                 fwrite($fp, $sitemap);
                 fflush($fp);
                 flock($fp, LOCK_UN);
                 fclose($fp);
                 $retval = true;
             } else {
                 COM_errorLog(__METHOD__ . ': Cannot lock the sitemap file for writing: ' . $filename);
             }
         }
     }
     return $retval;
 }
开发者ID:milk54,项目名称:geeklog-japan,代码行数:53,代码来源:xmlsitemap.class.php

示例7: rewind

 /**
  * Sets the file position indicator for fp to the beginning of the 
  * file stream. 
  * 
  * This function is identical to a call of $f->seek(0, SEEK_SET)
  *
  * @throws  io.IOException in case of an error
  */
 public function rewind()
 {
     if (FALSE === ($result = gzrewind($this->_fd))) {
         throw new IOException('cannot rewind file pointer');
     }
     return TRUE;
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:15,代码来源:ZipFile.class.php

示例8: rewind

 /**
  * Sets the file position indicator for fp to the beginning of the 
  * file stream. 
  * 
  * This function is identical to a call of $f->seek(0, SEEK_SET)
  *
  * @throws  io.IOException in case of an error
  */
 public function rewind()
 {
     if (false === ($result = gzrewind($this->_fd))) {
         throw new IOException('cannot rewind file pointer');
     }
     return true;
 }
开发者ID:johannes85,项目名称:core,代码行数:15,代码来源:ZipFile.class.php

示例9: var_dump

var_dump(readgzfile($tmpfile));
$zipped = gzencode("testing gzencode");
VS(gzdecode($zipped), "testing gzencode");
$f = gzopen($tmpfile, "w");
VERIFY($f !== false);
gzputs($f, "testing gzputs\n");
gzwrite($f, "<html>testing gzwrite</html>\n");
gzclose($f);
$f = gzopen($tmpfile, "r");
VS(gzread($f, 7), "testing");
VS(gzgetc($f), " ");
VS(gzgets($f), "gzputs\n");
VS(gzgetss($f), "testing gzwrite\n");
VS(gztell($f), 44);
VERIFY(gzeof($f));
VERIFY(gzrewind($f));
VS(gztell($f), 0);
VERIFY(!gzeof($f));
gzseek($f, -7, SEEK_END);
VS(gzgets($f), "testing gzputs\n");
gzclose($f);
$f = gzopen(__DIR__ . "/test_ext_zlib.gz", "r");
gzpassthru($f);
$compressable = str_repeat('A', 1024);
$s = $compressable;
$t = nzcompress($s);
VERIFY(strlen($t) < strlen($s));
$u = nzuncompress($t);
VS($u, $s);
$compressable = str_repeat('\\0', 1024);
$bs = $compressable;
开发者ID:badlamer,项目名称:hhvm,代码行数:31,代码来源:ext_zlib.php

示例10: reset

 /**
  * Resets the input stream.
  */
 public function reset()
 {
     if (!is_resource($this->_stream)) {
         throw new Opl_Stream_Exception('Input stream is not opened.');
     }
     gzrewind($this->_stream);
 }
开发者ID:OPL,项目名称:Open-Power-Libs,代码行数:10,代码来源:Input.php

示例11: rewind

 /**
  * Rewinds the file pointer to the beginning.
  */
 function rewind()
 {
     if (gzrewind($this->fh) === false) {
         throw new \Aimeos\MW\Container\Exception(sprintf('Unable to rewind file "%1$s"', $this->getResource()));
     }
     $this->position = 0;
     $this->data = $this->getData();
 }
开发者ID:mvnp,项目名称:aimeos-core,代码行数:11,代码来源:Gzip.php

示例12: rewind

 /**
  * Go back to the start of reading an open archive
  **/
 function rewind()
 {
     if ($this->file_writing) {
         return;
     }
     if ($this->file_handle === false) {
         return;
     }
     if ($this->gz_mode) {
         gzrewind($this->file_handle);
     } else {
         rewind($this->file_handle);
     }
     $this->seek_length = 0;
 }
开发者ID:BackupTheBerlios,项目名称:qsf-svn,代码行数:18,代码来源:tar.php

示例13: rewind

 /**
  * Rewinds the file pointer to the beginning.
  */
 function rewind()
 {
     if (gzrewind($this->_fh) === false) {
         throw new MW_Container_Exception(sprintf('Unable to rewind file "%1$s"', $this->getResource()));
     }
     $this->_position = 0;
     $this->_data = $this->_getData();
 }
开发者ID:Bananamoon,项目名称:aimeos-core,代码行数:11,代码来源:Gzip.php

示例14: gzrewind

 /**
  * Rewind the position of a gz-file pointer
  *
  * @param resource $zp The gz-file pointer. It must be valid, and must point to a file
  *                     successfully opened by gzopen.
  *
  * @return bool
  */
 public function gzrewind($zp) : bool
 {
     return gzrewind($zp);
 }
开发者ID:aurimasniekis,项目名称:php-wrappers,代码行数:12,代码来源:Zlib.php

示例15: gzopen

<?php

$f = "temp2.txt.gz";
$h = gzopen($f, 'w');
gzwrite($h, 'The first string.');
var_dump(gzrewind($h));
gzwrite($h, 'The second string.');
gzclose($h);
$h = gzopen($f, 'r');
gzpassthru($h);
gzclose($h);
unlink($f);
echo "\n";
?>
===DONE===
开发者ID:badlamer,项目名称:hhvm,代码行数:15,代码来源:gzrewind_variation1.php


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