「PHP Programming/Files」の版間の差分

削除された内容 追加された内容
21 行
 
==Reading==
Reading can be done in a number of ways. If you just want all the contents of a file available to work with, you can use the [http://php.net/file_get_contents file_get_contents()] function. If you want each line of the file in an array, you can use the [http://php.net/file file()] command. For total control over reading from files, [http://php.net/fread() fread()] can be used.
 
These functions are usually interchangeable and each can be used to perform each other's function. The first two do not require that you first open the file with fopen() or then close it with fclose(). These are good for quick, one-time file operations. If you plan on performing multiple operations on a file it is best to use fopen() in conjunction with fread(), fwrite() and fclose() as it is more efficient.