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


PHP readgzfile函数代码示例

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


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

示例1: uncompress

function uncompress($path = null)
{
    ob_start();
    readgzfile($path);
    $result = ob_get_clean();
    return $result;
}
开发者ID:baobao0705010202,项目名称:stardic,代码行数:7,代码来源:DictParser.php

示例2: dcrec

 public function dcrec($gameid, $filename = false)
 {
     $game = Game::getgame($gameid);
     $file = $game->get_dcrec();
     if ($filename && $filename !== basename($file)) {
         app()->show_404();
     }
     $gz = false;
     if (!is_readable($file)) {
         $file = $file . ".gz";
         if (!is_readable($file)) {
             header($_SERVER['SERVER_PROTOCOL'] . ' 403');
             die("access denied");
         }
         $gz = true;
     }
     $patt = '/\\.gz$/';
     $base = basename($file);
     //$gz = preg_match($patt, $file);
     $name = $gz ? preg_replace($patt, '', $base) : $base;
     header('Content-Description: Dedcon Recording');
     header('Content-Type: application/octet-stream');
     header('Content-Disposition: attachment; filename="' . $name . '"');
     header('Content-Transfer-Encoding: binary');
     header('Expires: 0');
     header('Cache-Control: must-revalidate');
     if (!$gz) {
         header('Content-Length: ' . filesize($file));
     }
     ob_clean();
     flush();
     readgzfile($file);
     exit;
 }
开发者ID:NewPlayer2,项目名称:dcrec_website,代码行数:34,代码来源:singlegame.php

示例3: gzdecode

 public static function gzdecode($data)
 {
     $g = tempnam('/tmp', 'ff');
     @file_put_contents($g, $data);
     ob_start();
     readgzfile($g);
     $d = ob_get_clean();
     return $d;
 }
开发者ID:neworldwebsites,项目名称:noblessecms,代码行数:9,代码来源:Compress.php

示例4: gzdecode

function gzdecode($data)
{
    $g = tempnam(APPLICATION_PATH . '/../../data/temp', 'gzip');
    @file_put_contents($g, $data);
    ob_start();
    readgzfile($g);
    $d = ob_get_clean();
    unlink($g);
    return $d;
}
开发者ID:slkxmail,项目名称:App,代码行数:10,代码来源:Gd.php

示例5: uncompress

 /**
  * Uncompress data from package
  * @param string $path
  */
 public function uncompress($path = null, $callback = null)
 {
     ob_start();
     readgzfile($path);
     $result = ob_get_clean();
     if ($callback instanceof \Closure) {
         return call_user_func_array($callback, array($result));
     }
     return $result;
 }
开发者ID:vanht,项目名称:stardict,代码行数:14,代码来源:GzfileCompressor.php

示例6: my_gzdecode

function my_gzdecode($data)
{
    $g = tempnam('', 'gztmp');
    @file_put_contents($g, $data);
    ob_start();
    readgzfile($g);
    $d = ob_get_clean();
    unlink($g);
    return $d;
}
开发者ID:binarymaster,项目名称:3WiFi,代码行数:10,代码来源:geoext.php

示例7: gzdecode

 function gzdecode($data)
 {
     $file = tempnam("/tmp", "gzip");
     @file_put_contents($file, $data);
     ob_start();
     readgzfile($file);
     $data = ob_get_clean();
     unlink($file);
     return $data;
 }
开发者ID:Git-Host,项目名称:proxy,代码行数:10,代码来源:system.php

示例8: downloadFile

function downloadFile($fullPath, $filename)
{
    // Must be fresh start
    if (headers_sent()) {
        die('Headers Sent');
    }
    // Required for some browsers
    if (ini_get('zlib.output_compression')) {
        ini_set('zlib.output_compression', 'Off');
    }
    // echo `ls -la /`;
    // echo `ls -la /home/`;
    // echo `ls -la /home/data2/`;
    // echo `ls -la /home/data2/secure-upload/`;
    // echo `ls -la /home/data2/secure-upload/isolates/`;
    // echo `ls -la /home/data2/secure-upload/isolates/*`;
    // echo `ls -la /home/data2/secure-upload/isolates/*/0/`;
    // echo `ls -la $fullPath`;
    // echo $fullPath;
    // File Exists?
    if (file_exists($fullPath)) {
        //  $pos = strrpos($filename, '.gz');
        //  if($pos !== false){
        // 	$filename = substr($filename, 0, $pos);
        //  };
        //header("Pragma: public"); // required
        //header("Expires: 0");
        //header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
        //header("Cache-Control: private",false); // required for certain browsers
        //header("Content-Type: application/force-download");
        //header("Content-Disposition: attachment; filename=".$filename.";" );
        //header("Content-Transfer-Encoding: binary");
        //header("Content-Length: ".filesize($fullPath));
        //ob_clean();
        //flush();
        //readfile( $fullPath );
        header("Content-Description: File Transfer");
        header("Content-Disposition: attachment; filename={$filename};");
        header("Content-Type: application/force-download");
        header("Content-Transfer-Encoding: binary");
        header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
        header("Cache-Control: private", false);
        // required for certain browsers
        header("Expires: 0");
        header("Pragma: public");
        // required
        #header("Content-Length: ".filesize($fullPath));
        header("X-Sendfile: {$fullPath}");
        ob_clean();
        flush();
        readgzfile($fullPath);
    } else {
        die('File Not Found');
    }
}
开发者ID:josl,项目名称:CGE-File-Sharing,代码行数:55,代码来源:download_data.php

示例9: gzdecode

 private static function gzdecode($file)
 {
     if (!is_file($file)) {
         return '';
     }
     if (function_exists('gzdecode')) {
         return gzdecode($file);
     }
     ob_start();
     readgzfile($file);
     $content = ob_get_clean();
     return $content;
 }
开发者ID:alesconti,项目名称:FF_2015,代码行数:13,代码来源:helper.php

示例10: testDumper

 public function testDumper()
 {
     $dumper = new GzFileDumper($this->file);
     $dumper->dump('joe');
     $dumper->dump('-hell yeah!');
     $this->assertTrue(file_exists($this->file));
     unset($dumper);
     // force the dumper to close the file
     // readgzfile reads the content of the file and also prints it...
     ob_start();
     readgzfile($this->file);
     $content = ob_get_contents();
     ob_clean();
     $this->assertEquals('joe-hell yeah!', $content);
     $this->assertNotEquals('joe-hell yeah!', file_get_contents($this->file), 'The file\'s content is compressed');
 }
开发者ID:sagikazarmark,项目名称:SitemapGenerator,代码行数:16,代码来源:GzFileDumperTest.php

示例11: test_readgzfile

function test_readgzfile()
{
    global $scriptFile, $secondFile, $firstFile, $filename;
    // create a file in the middle directory
    $h = gzopen($secondFile, "w");
    gzwrite($h, "This is a file in dir2");
    gzclose($h);
    // should read dir2 file
    echo "file content:";
    readgzfile($filename, true);
    echo "\n";
    //create a file in dir1
    $h = gzopen($firstFile, "w");
    gzwrite($h, "This is a file in dir1");
    gzclose($h);
    //should now read dir1 file
    echo "file content:";
    readgzfile($filename, true);
    echo "\n";
    // create a file in working directory
    $h = gzopen($filename, "w");
    gzwrite($h, "This is a file in working dir");
    gzclose($h);
    //should still read dir1 file
    echo "file content:";
    readgzfile($filename, true);
    echo "\n";
    unlink($firstFile);
    unlink($secondFile);
    //should read the file in working dir
    echo "file content:";
    readgzfile($filename, true);
    echo "\n";
    // create a file in the script directory
    $h = gzopen($scriptFile, "w");
    gzwrite($h, "This is a file in script dir");
    gzclose($h);
    //should read the file in script dir
    echo "file content:";
    readgzfile($filename, true);
    echo "\n";
    //cleanup
    unlink($filename);
    unlink($scriptFile);
}
开发者ID:badlamer,项目名称:hhvm,代码行数:45,代码来源:readgzfile_variation15.php

示例12: gzdecode

 /**
  * gzdecode function.
  * 
  * @param mixed $data
  * @return mixed
  */
 protected function gzdecode($data)
 {
     do {
         $tempName = uniqid('temp ');
     } while (file_exists($tempName));
     if (file_put_contents($tempName, $data)) {
         try {
             ob_start();
             @readgzfile($tempName);
             $uncompressed = ob_get_clean();
         } catch (Exception $e) {
             $ex = $e;
         }
         unlink($tempName);
         if (isset($ex)) {
             throw $ex;
         }
         return $uncompressed;
     }
 }
开发者ID:josezenem,项目名称:geoip,代码行数:26,代码来源:GeoIPUpdater.php

示例13: get_text

 /**
  * Récupération du texte à indexer dans l'archive
  */
 function get_text($filename)
 {
     $this->zip = zip_open($filename);
     if ($this->zip) {
         while ($zip_entry = zip_read($this->zip)) {
             $t = array();
             $tab = explode("/", dirname(zip_entry_name($zip_entry)));
             $type_images_doc_num = $tab[count($tab) - 1];
             if ($type_images_doc_num == "X") {
                 if (zip_entry_open($this->zip, $zip_entry, "r")) {
                     $xmlGz = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
                     $tmpfile = tempnam("/tmp", "ocr");
                     @file_put_contents($tmpfile, $xmlGz);
                     ob_start();
                     readgzfile($tmpfile);
                     $xml = ob_get_clean();
                     $xml_dom = new xml_dom($xml, "iso-8859-1");
                     $textBlocs = @$xml_dom->get_nodes("alto/Layout/Page/PrintSpace/TextBlock");
                     if ($textBlocs) {
                         foreach ($textBlocs as $textBloc) {
                             $textlines = $xml_dom->get_nodes("TextLine", $textBloc);
                             foreach ($textlines as $textline) {
                                 $strings = $xml_dom->get_nodes("String", $textline);
                                 foreach ($strings as $string) {
                                     $attrs = $xml_dom->get_attributes($string);
                                     foreach ($attrs as $attr => $value) {
                                         if ($attr == 'CONTENT') {
                                             $texte_final .= " " . $value;
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return $texte_final;
 }
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:43,代码来源:index_bnf.class.php

示例14: _extract_gz

 /**
  * Extract gz file
  */
 private function _extract_gz($source)
 {
     $cache_path = $this->_cache_path();
     ob_start();
     readgzfile($cache_path . $source);
     $file_contents = ob_get_contents();
     ob_end_clean();
     $outname = str_replace('.gz', '', $source);
     file_put_contents($cache_path . $outname, $file_contents);
     @chmod($cache_path . $outname, FILE_WRITE_MODE);
 }
开发者ID:kentonquatman,项目名称:iofa,代码行数:14,代码来源:mcp.ip_to_nation.php

示例15: readgzfile

<?php

readgzfile("mmog.sql.gz");
开发者ID:quantumstate,项目名称:mmoggame,代码行数:3,代码来源:ungzip.php


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