There are many ways to convert text files into arrays in php. The most direct way is to use the file function
such as
The code is as follows
代码如下 |
复制代码 |
$array = file('bKjia.c0m.txt');
print_r( $array );
|
|
Copy code
|
$array = file('bKjia.c0m.txt');
print_r( $array );
|
This will directly output the array. Friends can try it
Example 2
Some friends said that file_get_contents() first saves it to a variable and then uses explode to split it with nr. This is also a way, but the efficiency is much worse. I recommend the first method.
http://www.bkjia.com/PHPjc/631678.htmlwww.bkjia.com
trueTechArticleThere are many ways to convert text files into arrays in php. The most direct way we can use file The function code is as follows. Copy the code $array = file('111cn.net.txt'); print_r(...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn