php file() function
Translation results:
英[faɪl] 美[faɪl]
vt. File (divorce proceedings or other lawsuits); file...; file; publish and send to the newspaper
vi. Send (report to the newspaper); walk in a line; make an application
n. File; file (folder); column; file
Third person singular: files Plural: files Present participle: filing past tense: filed past participle: filed
php file() functionsyntax
Function: Read the entire file into an array.
Syntax: file(path,include_path,context)
Parameters:
Parameter | Description |
path | Required. Specifies the file to be read. |
include_path | Optional. If you also want to search for files in include_path, you can set this parameter to "1". |
context | Optional. Specifies the environment for a file handle. context is a set of options that can modify the behavior of the stream. If null is used, it is ignored. |
Note: Each row in the returned array includes the line terminator, so if you do not need the line terminator, you need to use rtrim() function.
php file() functionexample
<?php $txt = file("./test.txt"); print_r($txt); ?>