PHP file()函数 file()函数可以将整个文件读入数组中,数组中的每个元素对应文件中的一行,包括换行符。 语法 array file ( string filename [, intflags = 0 [, resource $context ]] )PHPCopy 示例 <?php print_r(file("/PhpProject/sample.txt")); ?>PHPCopy 输出 Array ( [0] => Tutorialspoint [1] => Tutorix [2] => TP )PHPCopy