Difference between revisions of "PHP/file/io"
Jump to navigation
Jump to search
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | This is a quick index to information about accessing files in PHP. | + | {{fmt/title|PHP file access functionality}} |
+ | {{:PHP/file/NAV}}This is a quick index to information about accessing files in PHP. | ||
==Functions== | ==Functions== | ||
* [https://www.php.net/manual/en/ref.filesystem.php Filesystem Functions] | * [https://www.php.net/manual/en/ref.filesystem.php Filesystem Functions] | ||
− | ** <code>[https://www.php.net/manual/en/function. | + | ** <code>[https://www.php.net/manual/en/function.file.php file()]</code>: read entire text file into an array (by line) |
− | ** <code>[https://www.php.net/manual/en/function.file-get-contents file_get_contents()]</code> | + | ** <code>[https://www.php.net/manual/en/function.file-get-contents file_get_contents()]</code>: read entire text file into a string |
** <code>[https://www.php.net/manual/en/function.file-put-contents file_put_contents()]</code> | ** <code>[https://www.php.net/manual/en/function.file-put-contents file_put_contents()]</code> | ||
− | * [https://www.php.net/manual/en/refs.fileprocess.file.php File System Related Extensions] | + | ** file-handle functions: |
+ | *** <code>[https://www.php.net/manual/en/function.fgetcsv fgetcsv()]</code> | ||
+ | *** <code>[https://www.php.net/manual/en/function.fgets fgets()]</code>: read a line | ||
+ | *** <code>[https://www.php.net/manual/en/function.fopen fopen()]</code>: open handle to file | ||
+ | *** ''<code>[https://www.php.net/manual/en/function.fputs.php fputs()]</code> is just an alias of <code>[https://www.php.net/manual/en/function.fwrite fwrite()]</code>'' | ||
+ | *** <code>[https://www.php.net/manual/en/function.fputcsv fputcsv()]</code>: write a line in [[CSV]] format | ||
+ | *** <code>[https://www.php.net/manual/en/function.fread fread()]</code>: binary-safe read | ||
+ | *** <code>[https://www.php.net/manual/en/function.fseek fseek()]</code>: seek absolute or relative position | ||
+ | *** <code>[https://www.php.net/manual/en/function.fwrite fwrite()]</code>: binary-safe write | ||
+ | * [https://www.php.net/manual/en/refs.fileprocess.file.php File System Related Extensions]: also includes {{l/same|filesystem}}-related extensions |
Latest revision as of 21:13, 13 August 2023
PHP file access functionality
|
PHP File fx() |
This is a quick index to information about accessing files in PHP.
Functions
- Filesystem Functions
file()
: read entire text file into an array (by line)file_get_contents()
: read entire text file into a stringfile_put_contents()
- file-handle functions:
- File System Related Extensions: also includes filesystem-related extensions