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> <gzwrite
Last updated: Sun, 25 Nov 2007

view this page in

readgzfile

(PHP 4, PHP 5)

readgzfile — .gz파일을 출력한다

Description

int readgzfile ( string $filename [, int $ use_include_path ] )

파일을 읽고, 압축해제를하고 standard output으로 출력한다.

readgzfile()은 gzip format이 아니더라도 읽을 수 있다.; 이 경우 readgzfile()은 바로 압축해제없이 파일을 읽어들이 수 있다.

파일로부터 읽어들인 바이트수(압축되지 않은)를 리턴한다. 만일 에러가 발생하면, -@readgzfile라고 불리우는 경우가 아닌한- FALSE를 반환하고, 에러메세지를 출력한다.

filename 은 파일시스템으로부터 열려지고, 그 내용은 standard output으로 출력된다.

include_path안의 파일을 검색하고자 원한다면, 두번째 옵션의 파라미터를 "1"을 넣으면 된다.

참고 gzpassthru(), gzfile(), gzopen().



add a note add a note User Contributed Notes
readgzfile
glennh at webadept dot net
02-Oct-2003 01: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> <gzwrite
Last updated: Sun, 25 Nov 2007
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites