text
stringlengths
1
254
output
stringlengths
2
255
If no length is specified, the length defaults to 1k, or 1024 bytes.
fpで指定したファイルポインタから最大length-1バイト読み出し、その 文字列を返します。読み出しは、length-1バイト読み出したか、(返り値 に含まれる)改行文字を検出したか、EOFに達したかのいずれかが起こっ た時点で終了します。lengthが指定されない場合、デフォルトは1kまた は1024バイトとなります。
The file pointer must be valid, and must point to a file successfully opened by fopen(), popen(), or fsockopen().
エラーが起こった場合、 FALSE を返します。
Example 1.
陥りやすい罠:
$handle = fopen ("/ tmp / inputfile.txt", "r"); while (!feof ($handle)) {$buffer = fgets($handle, 4096); echo $buffer;} fclose ($handle);
C言語のfgetsの動作に慣れている人は、EOFを返す条件の違いについて 注意する必要があります。
As of PHP 4.3, omitting length will keep reading from the stream until it reaches the end of the line.
ファイルポインタは有効なものでなければならず、また fopen() 、 popen() 、 fsockopen() で正常にオープンされたファイルを 指している必要があります。
Note:
簡単な例を以下に示します。
Earlier versions were not binary safe.
例 1行毎にファイルを読み込む
If you are having problems with PHP not recognizing the line endings when reading files either on or created by a Macintosh computer, you might want to enable the auto_detect_line_endings run-time configuration option.
注意 length パラメータは、PHP 4.2.0でオプション となりました。
Prev
fread(), fopen(), popen(), fgetc(), fsockopen(), socket_set_timeout() も参照下さい。
(PHP 3, PHP 4)
(PHP 3, PHP 4)
You can use the optional third parameter to specify tags which should not be stripped.
fgets() と同じですが、fgetssは読み込んだテキスト からHTMLおよびPHPのタグを取り除こうとすることが異なります。
If you are having problems with PHP not recognizing the line endings when reading files either on or created by a Macintosh computer, you might want to enable the auto_detect_line_endings run-time configuration option.
オプションの3番目の引数を使用して、取り除く必要がないタグを指定する ことができます。
Prev
注意 allowable_tags は、PHP 3.0.13、PHP 4.0.0 で追加されました。
file_exists
fgets(), fopen(), fsockopen(), popen(), strip_tags() も参照下さい。
(PHP 3, PHP 4)
(PHP 3, PHP 4)
The time is returned as a Unix timestamp.
ファイルの最終アクセス時刻を返し、エラーの場合は FALSE を返します。 時間はUNIXタイムスタンプとして返されます。
The atime of a file is supposed to change whenever the data blocks of a file are being read.
この関数の結果はキャッシュされます。詳細は、 clearstatcache() を参照下さい。
Some Unix filesystems can be mounted with atime updates disabled to increase the performance of such applications; USENET news spools are a common example.
注意: ファイルのatimeは、ファイルのデータブロックが読み込まれる度 に変更されるとみなされます。この仕様は、アプリケーションが非常に 多くのファイルまたはディレクトリに常にアクセスする場合に性能上の 負荷となる可能性があります。いくつかのUNIXファイルシステムでは、 このようなアプリケーションの性能を向上させるためにatimeの更新を無 効としてマウントすることが可能です。USENETのニューススプールが一 般的な例です。このようなファイルシステムでは、この関数は使用でき ません。
This function will not work on remote files; the file to be examined must be accessible via the server's filesystem.
この関数は、 リモートファイ ル では動作しません。評価するファイルはサーバのファイルシ ステムによりアクセス可能である必要があります。
(PHP 3, PHP 4)
(PHP 3, PHP 4)
The time is returned as a Unix timestamp.
ファイルの最終更新時刻を返し、エラーの場合は FALSE を返します。 時間はUNIXタイムスタンプとして返されます。
See clearstatcache() for more details.
この関数の結果はキャッシュされます。詳細は、 clearstatcache() を参照下さい。
See also filemtime() (which is what you want to use when you want to create "Last Modified "footers on web pages) and fileatime().
注意: 多くのUNIXファイルシステムでは、i-ノードが変更された際、つ まり、パーミッション、所有者、グループ、または他のメタデータが書 き込まれた際に、ファイルが変更されたとみなされます。 filemtime() (この関数はWebページ上で"Last Modified"フッタを作成したい場合に使用するものです。)および fileatime() も参照下さい。
This is wrong.
いくつかのUNIXでは、ファイルのctimeはファイルの作成時間として参照 されます。これは間違っています。多くのUNIXファイルシステムでは UNIXファイルの作成時間は存在しません。
This function will not work on remote files; the file to be examined must be accessible via the server's filesystem.
この関数は、 リモートファイ ル では動作しません。評価するファイルはサーバのファイルシ ステムによりアクセス可能である必要があります。
Returns TRUE if the file specified by filename exists; FALSE otherwise.
(PHP 3, PHP 4)
The results of this function are cached.
filename で指定したファイルが存在 すれば TRUE を返し、そうでなければ FALSE を返します。
On windows, use / /computername / share / filename or \\\\computername\share\filename to check files on network shares.
この関数は、 リモートファイ ル では動作しません。調査を行うファイルはそのサーバーのファ イルシステムからアクセス可能である必要があります。
See also is_readable(), is_writable(), is_file() and file().
この関数の結果はキャッシュされます。詳細は、 clearstatcache() を参照下さい。
Prev
(PHP 4 = 4.3.0)
Identical to file(), except that file_get_contents() returns the file in a string.
Identical to file(), except that file_get_contents() returns the file in a string.
This function is binary-safe.
注意 この関数はバイナリデータに対応しています。
See fopen() for more details on how to specify the filename and Appendix I for a list of supported URL protocols.
ティップ "fopen wrappers"が有効になっていると、この関数のファイル名としてURLを使用することが出来ます。詳細は fopen() を参照して下さい。
Prev
See also: fgets(), file(), fread(), include(), and readfile().
(PHP 3, PHP 4)
(PHP 3, PHP 4)
The group ID is returned in numerical format, use posix_getgrgid() to resolve it to a group name.
ファイルの所有者のグループIDを返し、エラーの場合は FALSE を返します。 グループIDは数値で返されます。グループ名に変換するには posix_getgrgid() を使用して下さい。
See clearstatcache() for more details.
この関数の結果はキャッシュされます。詳細は、 clearstatcache() を参照下さい。
This function will not work on remote files; the file to be examined must be accessible via the server's filesystem.
注意 この関数はWindows環境にはまだ実装されていません。
filectime
注意 この関数は、 リモートファイ ル では動作しません。評価するファイルはサーバのファイルシ ステムによりアクセス可能である必要があります。
Each element of the array corresponds to a line in the file, with the newline still attached.
(PHP 3, PHP 4)
Each line in the resulting array will include the line ending, so you still need to use trim() if you do not want the line ending present.
readfile() と同じですが、 file() はファイルを配列に入れて返すところが異なります。 配列の各要素はファイルの各行に対応します。改行記号はついたままと なります。
You can use the optional use_include_path parameter and set it to "1", if you want to search for the file in the include_path, too.
オプションの2番目の引数を使用して、これに"1"を設定することにより、 include_path のファイルの検索も行うことができます。
In PHP 4.3.0 file() became binary safe.
この関数は(まだ)バイナリデータ対応ではありません!
See fopen() for more details on how to specify the filename and Appendix I for a list of supported URL protocols.
ティップ "fopen wrappers"が有効になっていると、この関数のファイル名としてURLを使用することが出来ます。詳細は fopen() を参照して下さい。
Prev
readfile(), fopen(), fsockopen(), popen() も参照下 さい。
(PHP 3, PHP 4)
(PHP 3, PHP 4)
Returns the inode number of the file, or FALSE in case of an error.
ファイルのinode番号を返し、エラーの場合は FALSE エ?します。
See clearstatcache() for more details.
この関数の結果はキャッシュされます。詳細は、 clearstatcache() を参照下さい。
This function will not work on remote files; the file to be examined must be accessible via the server's filesystem.
この関数は、 リモートファイ ル では動作しません。評価するファイルはサーバのファイルシ ステムによりアクセス可能である必要があります。
filegroup
注意 この関数はWindows環境にはまだ実装されていません。
(PHP 3, PHP 4)
(PHP 3, PHP 4)
The time is returned as a Unix timestamp, which is suitable for the date() function.
ファイルの最終更新時刻を返し、エラーの場合は FALSE を返します。時間はUNIXタイムスタンプとして返されます。
This function will not work on remote files; the file to be examined must be accessible via the server's filesystem.
この関数の結果はキャッシュされます。詳細は、 clearstatcache() を参照下さい。
Example 1. filemtime() example
この関数は、 リモートファイ ル では動作しません。評価するファイルはサーバのファイルシ ステムによりアクセス可能である必要があります。
See also filectime(), stat(), touch(), and getlastmod().
注意:この関数は、ファイルのブロックデータが書き込まれた時間を返し ます。これは、ファイルの内容が変更された際の時間です。ページのフッ タで使用するために出力可能な修正時刻を取得するには、この関数の結 果を date() に使用して下さい。
(PHP 3, PHP 4)
(PHP 3, PHP 4)
The user ID is returned in numerical format, use posix_getpwuid() to resolve it to a username.
ファイルの所有者のユーザIDを返し、エラーの場合は FALSE を返します。 ユーザIDは数値で返されます。ユーザー名に変換するには posix_getpwuid() を使用して下さい。
See clearstatcache() for more details.
この関数の結果はキャッシュされます。詳細は、 clearstatcache() を参照下さい。
This function will not work on remote files; the file to be examined must be accessible via the server's filesystem.
この関数は、 リモートファイ ル では動作しません。評価するファイルはサーバのファイルシ ステムによりアクセス可能である必要があります。
filemtime
注意 この関数はWindows環境にはまだ実装されていません。
Prev
(PHP 3, PHP 4)
Returns the permissions on the file, or FALSE in case of an error.
ファイルの許可属性を返し、エラーの場合は FALSE を返します。
The results of this function are cached.
この関数は、 リモートファイ ル では動作しません。評価するファイルはサーバのファイルシ ステムによりアクセス可能である必要があります。
Prev
この関数の結果はキャッシュされます。詳細は、 clearstatcache() を参照下さい。
Prev
(PHP 3, PHP 4)
Returns the number of fields (columns) in the opened filePro database.
オープンした filePro データベースのフィールド(カラム)の数を返し ます。
Prev
filepro() も参照下さい。
Prev
(PHP 3, PHP 4)
Returns the name of the field corresponding to field_number.
field_number に対応するフィールド名を返し ます。
Prev
(PHP 3, PHP 4)
Returns the edit type of the field corresponding to field_number.
field_number に対応した編集フィールド型を 返します。
Prev
(PHP 3, PHP 4)
Returns the width of the field corresponding to field_number.
field_number に対応するフィールドの幅を返 します。
Prev
(PHP 3, PHP 4)
This reads and verifies the map file, storing the field count and info.
この関数は、map ファイルを読み込み、照合を行います。 続いて、フィールドの数および情報を保存します。
Note:
データベースのロックを行わないため、PHP でオープンしている間は、 filePro データベースの修正を避ける必要があります。
Prev
注意 セーフモード が有効の場合、PHP は操作を行うファイル/ディレクトリが実行するスクリプトと同じUIDを有しているかどうかを確認します。
Prev
(PHP 3, PHP 4)
Returns the data from the specified location in the database.
データベースの指定された位置からデータを返します
Prev
注意 セーフモード が有効の場合、PHP は操作を行うファイル/ディレクトリが実行するスクリプトと同じUIDを有しているかどうかを確認します。
Prev
(PHP 3, PHP 4)
Returns the number of rows in the opened filePro database.
オープンされた filePro データベースにおける行の数を返します。
See also filepro().
注意 セーフモード が有効の場合、PHP は操作を行うファイル/ディレクトリが実行するスクリプトと同じUIDを有しているかどうかを確認します。
filepro_retrieve
filepro() も参照下さい。
Prev
(PHP 3, PHP 4)
Returns the size of the file in bytes, or FALSE in case of an error.
ファイルのサイズを返し、エラーの場合は FALSE を返します。
See clearstatcache() for more details.
この関数の結果はキャッシュされます。詳細は、 clearstatcache() を参照下さい。
Prev
この関数は、 リモートファイ ル では動作しません。評価するファイルはサーバのファイルシ ステムによりアクセス可能である必要があります。
(PHP 3, PHP 4)
(PHP 3, PHP 4)
Possible values are fifo, char, dir, block, link, file, and unknown.
ファイルのサイズを返します。返される値は fifo, char, dir, block, link, file, unknown のいずれかです。
Returns FALSE if an error occurs. filetype() will also produce an E_NOTICE message if the stat call fails or if the file type is unknown.
エラーが起こった場合 FALSE を返します。
See clearstatcache() for more details.
この関数の結果はキャッシュされます。詳細は、 clearstatcache() を参照下さい。
See also: is_dir(), is_file(), is_link(), file_exists(), and stat().
この関数は、 リモートファイ ル では動作しません。評価するファイルはサーバのファイルシ ステムによりアクセス可能である必要があります。
(PHP 4 = 4.2.0)
(PHP 4 = 4.2.0)
Var may be any scalar type.
var の float 値を返します。
$var = '122.34343The'; $float_value_of_var = floatval ($var); print $float_value_of_var; / / prints 122.34343
var はあらゆるスカラー型とすることが可能で す。配列またはオブジェクトに floatval() を使用す ることはできません。
Prev
intval(), strval(), settype(), 型の相互変換 も参照下さい。
Prev
(PHP 3 = 3.0.7, PHP 4)
PHP supports a portable way of locking complete files in an advisory way (which means all accessing programs have to use the same way of locking or it will not work).
PHP は、恣意的にファイルをロックする汎用の手段を提供します。 (これは、アクセスする全プログラムが同一のロックの方法を使用する 必要があり、そうでない場合は動作しないことを意味します)
To acquire a shared lock (reader), set operation to LOCK_SH (set to 1 prior to PHP 4.0.1).
flock() は、 fp を用いて 操作を行います。これは、オープンされたファイルポインタである必要が あります。 operation は、次の値のどれかとな ります。