Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
PHP: readgzfile - Manual
[go: Go Back, main page]

PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

zlib_get_coding_type" width="11" height="7"/> <gzwrite
Last updated: Mon, 05 Feb 2007

view this page in

readgzfile

(PHP 4, PHP 5)

readgzfile — gz ファイルを出力する

説明

int readgzfile ( string filename [, int use_include_path] )

ファイルを読み込み、解凍し、標準出力に書き込みます。

readgzfile()は、gzip フォーマットでないファイルの読込にも使用可能です。この場合、 readgzfile() はファイルを解凍せずに直接読込みます。

パラメータ

filename

ファイル名を指定します。このファイルはファイルシステムからオープンされ、 内容は標準出力に書き込まれます。

use_include_path

include_path にあるファイルも検索したい場合、このオプションパラメータを 1 に設定してください。

返り値

ファイルから読み込んだ (解凍された) データのバイト数を返します。 エラーが発生した場合、FALSE が返され、@readgzfile としてコールされている場合を除き、エラーメッセージが出力されます。

参考

gzpassthru()
gzfile()
gzopen()



add a note add a note User Contributed Notes
readgzfile
glennh at webadept dot net
02-Oct-2003 05:52
This is a rather simple example of usage for this function, but it does work, and it solved a problem I was using with old browsers accessing gzipped files.

<?PHP
 
// first we need to stop the server from sending any headers at all. 
ob_start();
 
readgzfile("test.html.gz"); // read the file and output directly to
the browser
                                    
// non compressed data from the
file
 
ob_end_flush
(); // let the headers go// 
 
?>

There is no need for any html formating if the source file is an HTML formated page, such as the ones I'm using are. Checking the browser version, sends either the gzip file directly, or sends the browser to a page like this, which does the work for it. Well done simple function.

My server is running PHP 4.2.2 on Linux Redhat version 9 and
Apache 2.0.40

zlib_get_coding_type" width="11" height="7"/> <gzwrite
Last updated: Mon, 05 Feb 2007
 
 
show source | credits | sitemap | contact | advertising | mirror sites