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


PHP bzwrite函数代码示例

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


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

示例1: _write

 /**
  * {@inheritdoc}
  */
 protected function _write($data)
 {
     $result = bzwrite($this->_fileHandler, $data);
     if (false === $result) {
         throw new \Magento\Framework\Exception\LocalizedException(new \Magento\Framework\Phrase('Failed to write data to %1', [$this->_filePath]));
     }
 }
开发者ID:IlyaGluschenko,项目名称:test001,代码行数:10,代码来源:Bz.php

示例2: _write

 /**
  * Write data to bz archive
  * 
  * @throws Mage_Exception
  * @param $data
  */
 protected function _write($data)
 {
     $result = @bzwrite($this->_fileHandler, $data);
     if (false === $result) {
         throw new Mage_Exception('Failed to write data to ' . $this->_filePath);
     }
 }
开发者ID:okite11,项目名称:frames21,代码行数:13,代码来源:Bz.php

示例3: bzip

 function bzip($infile, $outfile)
 {
     $fp = fopen($infile, "r");
     $data = fread($fp, filesize($infile));
     fclose($fp);
     $zp = bzopen($outfile, "w");
     bzwrite($zp, $data);
     bzclose($zp);
 }
开发者ID:BackupTheBerlios,项目名称:idb,代码行数:9,代码来源:compression.php

示例4: write

 public function write($file, $data)
 {
     $open = bzopen($file, 'w');
     if (empty($open)) {
         throw new FileNotFoundException('Error', 'fileNotFound', $file);
     }
     $return = bzwrite($open, $data, strlen($data));
     bzclose($open);
     return $return;
 }
开发者ID:znframework,项目名称:znframework,代码行数:10,代码来源:BZ.php

示例5: compress

 /**
  * Compress a file with bzip2
  *
  * @param  string $file
  * @return mixed
  */
 public static function compress($file)
 {
     $fullpath = realpath($file);
     $file = file_get_contents($file);
     // Create the new Bzip2 file resource, write data and close it
     $bzResource = bzopen($fullpath . '.bz2', 'w');
     bzwrite($bzResource, $file, strlen($file));
     bzclose($bzResource);
     return $fullpath . '.bz2';
 }
开发者ID:popphp,项目名称:pop-archive,代码行数:16,代码来源:Bz2.php

示例6: write

 function write($data)
 {
     $data = (string) $data;
     if ($this->stream instanceof \IO\Buffer\Stream) {
         $length = $this->stream->getLength();
     } else {
         $length = strlen($data);
     }
     return bzwrite($this->stream->getPointer(), $data, $length);
 }
开发者ID:Kinetical,项目名称:Kinesis,代码行数:10,代码来源:Writer.php

示例7: _bz2

 function _bz2($string, $state)
 {
     bzwrite($this->fp, $string);
     if ($state & PHP_OUTPUT_HANDLER_END) {
         bzclose($this->fp);
         $return = file_get_contents($this->filename);
         unlink($this->filename);
         return $return;
     }
     return "";
 }
开发者ID:ly95,项目名称:adminer,代码行数:11,代码来源:dump-bz2.php

示例8: compress

 public function compress($fileName)
 {
     $this->tarHandler->compress($fileName);
     $bzh = bzopen($fileName . '.tar.bz2', 'wb');
     $th = fopen($fileName . ".tar", 'rb');
     while (!feof($th)) {
         $ustr = fread($th, 1048576);
         bzwrite($bzh, $ustr);
     }
     bzclose($bzh);
     fclose($th);
 }
开发者ID:BackupTheBerlios,项目名称:alien-svn,代码行数:12,代码来源:bzip2.php

示例9: simpleWrite

 public function simpleWrite($zp = '', $data = '', $length = 0)
 {
     if (!is_resource($zp)) {
         return Error::set(lang('Error', 'resourceParameter', '1.(zp)'));
     }
     if (!isValue($data)) {
         return Error::set(lang('Error', 'valueParameter', '2.(data)'));
     }
     if ($length === 0) {
         $length = strlen($data);
     }
     return bzwrite($zp, $data, $length);
 }
开发者ID:Allopa,项目名称:ZN-Framework-Starter,代码行数:13,代码来源:BZDriver.php

示例10: write

 public function write($file = '', $data = '', $mode = NULL)
 {
     if (!is_string($file) || empty($file)) {
         return Error::set('Error', 'stringParameter', '1.(file)');
     }
     if (!is_scalar($data)) {
         return Error::set('Error', 'valueParameter', '2.(data)');
     }
     $open = bzopen($file, 'w');
     if (empty($open)) {
         return Error::set('Error', 'fileNotFound', $file);
     }
     $return = bzwrite($open, $data, strlen($data));
     bzclose($open);
     return $return;
 }
开发者ID:bytemtek,项目名称:znframework,代码行数:16,代码来源:BZ.php

示例11: test_bzwrite

function test_bzwrite()
{
    global $tmpfile;
    $str = "HipHop for";
    $bz = bzopen($tmpfile, "w");
    VERIFY($bz !== false);
    VS(bzwrite($bz, $str), 10);
    bzflush($bz);
    VERIFY(bzclose($bz));
    $bz = bzopen($tmpfile, "r");
    $ret = bzread($bz, 10000);
    VS($ret, $str);
    VERIFY(bzclose($bz));
    VS($ret, $str);
    unlink($tmpfile);
}
开发者ID:badlamer,项目名称:hhvm,代码行数:16,代码来源:ext_bzip2.php

示例12: compress

 /**
  * Static method to compress data
  *
  * @param  string $data
  * @param  int    $block
  * @return mixed
  */
 public static function compress($data, $block = 9)
 {
     // Compress the file
     if (file_exists($data)) {
         $fullpath = realpath($data);
         $data = file_get_contents($data);
         // Create the new Bzip2 file resource, write data and close it
         $bzResource = bzopen($fullpath . '.bz2', 'w');
         bzwrite($bzResource, $data, strlen($data));
         bzclose($bzResource);
         return $fullpath . '.bz2';
         // Else, compress the string
     } else {
         return bzcompress($data, $block);
     }
 }
开发者ID:akinyeleolubodun,项目名称:PhireCMS2,代码行数:23,代码来源:Bzip2.php

示例13: bzip2

 function bzip2($in, $out)
 {
     if (!file_exists($in) || !is_readable($in)) {
         return false;
     }
     if (!file_exists($out) && !is_writeable(dirname($out)) || file_exists($out) && !is_writable($out)) {
         return false;
     }
     $in_file = fopen($in, "r");
     $out_file = bzopen($out, "w");
     while (!feof($in_file)) {
         $buffer = fgets($in_file, 4096);
         bzwrite($out_file, $buffer, 4096);
     }
     fclose($in_file);
     bzclose($out_file);
     return true;
 }
开发者ID:uwitec,项目名称:eduoa,代码行数:18,代码来源:zipexport.php

示例14: write

 function write($data)
 {
     global $dump, $fp;
     if ($_POST['save'] == 0) {
         $dump .= $data;
     } else {
         switch ($_POST['compr']) {
             case 0:
                 fwrite($fp, $data);
                 break;
             case 1:
                 gzwrite($fp, $data);
                 break;
             case 2:
                 bzwrite($fp, $data);
                 break;
         }
     }
 }
开发者ID:insecuritea,项目名称:malware_sources,代码行数:19,代码来源:MySQLClient.php

示例15: bzip2_compress

function bzip2_compress($src_file, $dest_file = null)
{
    if ($dest_file == null) {
        $dest_file = $src_file;
    }
    $content = file_get_contents($src_file);
    if (empty($content)) {
        return 1;
    }
    $bz = bzopen($dest_file, "w");
    if (!$bz) {
        return 2;
    }
    $ret = bzwrite($bz, $content);
    if (!$ret) {
        bzclose($bz);
        return 3;
    }
    bzclose($bz);
    return 0;
}
开发者ID:shourya07,项目名称:zperfmon,代码行数:21,代码来源:compress.php


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