how to take data in txt files such as mysql?
(my first language is no english) i want to take data in txt files line by line.
Example:(This is my txt files)
exampleline1
exampleline2
exa开发者_C百科mpleline3
exampleline4
(1)i want to select all lines and print. How to?
(2)For example i want to print line 4. How to?
$lines = file("file.txt");
foreach($lines as $line){
echo $line."<br>";
}
to print line 4
echo $lines[3];
use (But be careful not to waste your memory):
file_get_contents
fgets
file
use function file(); which returns array (line by line)
精彩评论