参数 | 描述 |
---|---|
path | 必需。规定要读取的文件。 |
include_path | 可选。如果也想在 include_path 中搜寻文件的话,可以将该参数设为 "1"。 |
context |
可选。规定文件句柄的环境。 context 是一套可以修改流的行为的选项。若使用 null,则忽略。 |
start | 可选。规定在文件中开始读取的位置。该参数是 PHP 5.1 新加的。 |
max_length | 可选。规定读取的字节数。该参数是 PHP 5.1 新加的。 |
对 context 的支持是 PHP 5.0.0 添加的。
注释:本函数可安全用于二进制对象。
<?php print_r(file("test.txt")); ?>
输出:
Array ( [0] => Hello World. Testing testing! [1] => Another day, another line. [2] => If the array picks up this line, [3] => then is it a pickup line? )