本文整理汇总了PHP中gzpassthru函数的典型用法代码示例。如果您正苦于以下问题:PHP gzpassthru函数的具体用法?PHP gzpassthru怎么用?PHP gzpassthru使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gzpassthru函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_gzopen
function test_gzopen($mode)
{
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);
echo "\n** testing with mode={$mode} **\n";
// should read dir2 file
$h = gzopen($filename, $mode, true);
gzpassthru($h);
gzclose($h);
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
$h = gzopen($filename, $mode, true);
gzpassthru($h);
gzclose($h);
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
$h = gzopen($filename, $mode, true);
gzpassthru($h);
gzclose($h);
echo "\n";
unlink($firstFile);
unlink($secondFile);
//should read the file in working dir
$h = gzopen($filename, $mode, true);
gzpassthru($h);
gzclose($h);
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
$h = gzopen($filename, $mode, true);
gzpassthru($h);
gzclose($h);
echo "\n";
//cleanup
unlink($filename);
unlink($scriptFile);
}
示例2: gzopen
<?php
$f = "temp3.txt.gz";
$h = gzopen($f, 'w');
$str1 = "This is the first line.";
$str2 = "This is the second line.";
gzwrite($h, $str1);
echo "tell=";
var_dump(gztell($h));
//seek to the end which is not sensible of course.
echo "move to the end of the file\n";
var_dump(gzseek($h, 0, SEEK_END));
echo "tell=";
var_dump(gztell($h));
gzwrite($h, $str2);
echo "tell=";
var_dump(gztell($h));
gzclose($h);
echo "\nreading the output file\n";
$h = gzopen($f, 'r');
gzpassthru($h);
gzclose($h);
echo "\n";
unlink($f);
?>
===DONE===
示例3: doPasstrough
function doPasstrough($closeFile = true)
{
return @gzpassthru($this->File);
}
示例4: doPasstrough
function doPasstrough($closeFile = true)
{
$result = @gzpassthru($this->File);
if (!$closeFile) {
// The file must be reopened because gzpasstru will close the file.
$this->File = @gzopen($this->filename(), $this->mode(), $this->isBinaryMode());
} else {
$this->File = false;
}
return $result;
}
示例5: readgzfile
function readgzfile($fn)
{
if ($fp = gzopen($fn, "rb")) {
gzpassthru($fp);
}
}
示例6: dirname
<?php
$f = dirname(__FILE__) . "/004.txt.gz";
$h = gzopen($f, 'r');
$extra_arg = 'nothing';
var_dump(gzpassthru($h, $extra_arg));
var_dump(gzpassthru());
gzclose($h);
?>
===DONE===
示例7: json_encode
$json = json_encode($result);
echo $json;
die();
}*/
if ($atpagina == -1) {
if (file_exists('../../../preconsultas/consultas/' . $nome . ".txt.gz")) {
// $SQL = "UPDATE cache_tabela SET
// acessos = acessos+1,
// ultimo_acesso = now() WHERE nome LIKE '$nome'
// ";
// $bd = new bd();
// $bd->insert($SQL);
$myFile = '../../../preconsultas/consultas/' . $nome . ".txt.gz";
//metricas();
$fh = gzopen($myFile, 'r');
$theData = gzpassthru($fh);
die;
}
}
if (isset($_POST['json_search_names'])) {
$searchName = true;
} else {
$searchName = false;
}
$varReturn = false;
if (isset($_POST['dataBring']) && $_POST['dataBring'] == "var_only") {
$varReturn = true;
}
//die(var_dump($arrayConsulta));
$ObjConsulta = Consulta::tableParse($arrayConsulta);
//die(var_dump($ObjConsulta));
示例8: error_reporting
<?php
error_reporting(E_ALL);
$f = gzopen("ftp://83.247.110.3/traveltime.gz", "r");
ob_start();
gzpassthru($f);
$data = ob_get_clean();
$xml = simplexml_load_string(str_replace("soap:", "", $data));
$traveltimes = array();
$timestamp = null;
foreach ($xml->Body->d2LogicalModel->payloadPublication->siteMeasurements as $m) {
$traveltimes[(string) $m->measurementSiteReference["id"]] = $m->measuredValue->measuredValue->basicData;
if ($m->measurementTimeDefault) {
$timestamp = (string) $m->measurementTimeDefault;
}
}
$json = json_decode(file_get_contents("ndw-shapefiles-amsterdam.geojson"));
foreach ($json->features as $i => $f) {
$properties = new stdClass();
$properties->Id = $json->features[$i]->properties->dgl_loc;
$properties->Name = $json->features[$i]->properties->naam;
$properties->Type = $json->features[$i]->properties->wegtype;
$properties->Timestamp = $timestamp;
$properties->Length = $json->features[$i]->properties->lengte;
if (array_key_exists($f->properties->dgl_loc, $traveltimes)) {
$properties->Traveltime = (int) $traveltimes[$f->properties->dgl_loc]->travelTime->duration;
if ($properties->Traveltime > 0 && $properties->Length) {
$properties->Velocity = round($properties->Length / $properties->Traveltime * 3.6);
}
} else {
//unset($json->features[$i]);
示例9: dirname
<?php
// note that gzpassthru is an alias to fpassthru. parameter checking tests will be
// the same as fpassthru
$f = dirname(__FILE__) . "/004.txt.gz";
$h = gzopen($f, 'r');
var_dump(gzpassthru($h));
var_dump(gzpassthru($h));
gzclose($h);
?>
===DONE===
示例10: gzpassthru
/**
* Output all remaining data on 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 int
*/
public function gzpassthru($zp) : int
{
return gzpassthru($zp);
}
示例11: _internalCacheFunc
function _internalCacheFunc($start, $func = false, $params = false, $moreargs = false, $age = false)
{
global $cache_age_days, $gzip_page_cache, $enable_page_caching;
static $signature_stack = array();
if ($enable_page_caching == "false") {
return false;
}
if ($start) {
// START THE CACHE
$cacheFile = $this->createCachedPageName($func, $params, $moreargs);
// Did they specify an age?
if ($age && is_numeric($age)) {
$cache_age_days = $age;
}
if (is_file($cacheFile) and time() - filemtime($cacheFile) < $cache_age_days * 86400) {
if ($gzip_page_cache == "true") {
$fp = gzopen($cacheFile, 'r');
gzpassthru($fp);
} else {
include_once $cacheFile;
}
return true;
} else {
if (is_object($params)) {
writeLogData("messages", "Cache: Building cache for: " . $params->getName() . " type: " . $func);
}
ob_start();
array_push($signature_stack, $cacheFile);
}
} else {
// END THE CACHE
$cacheFile = array_pop($signature_stack);
if ($gzip_page_cache == "true") {
$fp = gzopen($cacheFile, 'w');
gzwrite($fp, ob_get_contents());
gzclose($fp);
} else {
$fp = fopen($cacheFile, 'w');
fwrite($fp, ob_get_contents());
fclose($fp);
}
ob_end_flush();
}
}
示例12: passThru
public function passThru($zp = '')
{
if (!is_resource($zp)) {
return Error::set(lang('Error', 'resourceParameter', '1.(zp)'));
}
return gzpassthru($zp);
}
示例13: header
break;
case "gz":
$ctype = "application/x-gzip";
break;
case "jpeg":
case "jpg":
$ctype = "image/jpg";
break;
default:
$ctype = "application/ocet-stream";
}
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: {$ctype}");
// change, added quotes to allow spaces in filenames, by Rajkumar Singh
header("Content-Disposition: attachment; filename=\"" . basename($_GET['file']) . "\";");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($_GET['file']));
ob_clean();
flush();
if (strcmp($info['extension'], 'gz') == 0) {
$file = gzopen($_GET['file'], 'r');
gzpassthru($file);
gzclose($file);
} else {
readfile($_GET['file']);
}