📜  php 将文本文件读入数组 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:18.080000             🧑  作者: Mango

代码示例1
//php read a text file into an array
//each item in the array is a line in the text file
//file.txt looks like this:
//hello
//testing
//text
//end file.txt (the file doesn't include the // marks
$file = file("http://example.com/file/file.txt");
echo $file[0]; //prints hello
echo $file[1]; //prints testing
echo $file[2]; //prints text