★ wanayoo — archive 1999 http://www.php.net/manual/ja/function.readfile.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to ファイルシステム
Quick Reference
English version of this pageGerman version of this pageItalian version of this pageFrench version of this pageHungarian version of this page
ファイルシステム
* basename
* chgrp
* chmod
* chown
* clearstatcache
* copy
* delete
* dirname
* diskfreespace
* fclose
* feof
* fgetc
* fgetcsv
* fgets
* fgetss
* file
* file_exists
* fileatime
* filectime
* filegroup
* fileinode
* filemtime
* fileowner
* fileperms
* filesize
* filetype
* flock
* fopen
* fpassthru
* fputs
* fread
* fscanf
* fseek
* fstat
* ftell
* ftruncate
* fwrite
* set_file_buffer
* is_dir
* is_executable
* is_file
* is_link
* is_readable
* is_writeable
* link
* linkinfo
* mkdir
* pclose
* popen
* readfile
* readlink
* rename
* rewind
* rmdir
* stat
* lstat
* realpath
* symlink
* tempnam
* touch
* umask
* unlink
Manual: readfile
View the source code for this pageSearch the site



Previous page
 popen
 Updated
Sat, 12 Aug 2000
readlink 
Next page


readfile

(PHP3 , PHP4 )

readfile -- ファイルを出力する

説明

int readfile (string filename [, int use_include_path])

ファイルを読んで標準出力に書き出します。

ファイルから読み込んだバイト数を返します。エラーが起こると falseを返し、また@readfileという名前でコールされない限り、 エラーメッセージが表示されます。

filenameが"http://"(大文字小文字は区別されません) で始まっている場合、指定されたサーバに対してHTTP 1.0コネクションが オープンされ、返されたテキストが標準出力に書き出されます。

HTTPリダイレクトは処理されないので、ディレクトリ名を 指定する場合は末尾にスラッシュを置く必要があります。

filenameが "ftp://"(大文字小文字は区別されません) で始まっている場合、指定されたサーバに対してFTPコネクションが オープンされ、要求したファイルが標準出力に書き出されます。 サーバがパッシブ・モードをサポートしていない場合、これは失敗します。

filenameが上記のいずれでもない 場合、ファイルはファイルシステムからオープンされ、その内容が 標準出力に書き出されます。

オプションの2番目の引数を使用して、これに"1"を設定することにより、 include_path のファイルの検索も行うことができます。

fpassthru(), file(), fopen(), include(), require(), virtual() も参照下さい。


User Contributed Notes: readfile


jurrit@home.nl
08-Mar-2000 08:49
This is actually more a question, but I will ask it any way.
I made a php3 script that pulls data from a MySQL database and puts it on the screen. Is it possible, to save what is on the screen, to a text file? Now I just click on the browsers save as.. function. But I want to automate this procedure.

Thanx in advance.

Jurrit



robert@abilina.org
15-Mar-2000 11:21
If you are using this function to read a remote server's page and the URL requires a cookie, there appears to be no way to read it using this function. It would be very nice if this were supported.


jason@familynet.net
15-May-2000 10:39
If you use readfile() to pull down HTML from an http:// source, is there a way to handle connection timeouts? For example, if the http server we are attempting to read from is down, how do you it it up to do something else (or even display an error)?


hicking@du.gtn.com
22-May-2000 09:21
You might want to try checking the $php_errormsg variable after calling readfile(...). To supress errormessages to your client's browser you could also add @ before readfile(...). Make sure you have track_errors enabled in your php configuration. See <A HREF=/old?u=http%3A%2F%2Fwww.php.net%2Fmanual%2Flanguage.operators.errorcontrol.php%26gt%3BError&y=1999 Control</A> in the manual.


 About Notes


Previous page
 popen
 Updated
Sat, 12 Aug 2000
readlink 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.