Created
July 25, 2018 12:42
-
-
Save bjzhush/874ed7596e4324c0a4577a37bfe651b8 to your computer and use it in GitHub Desktop.
流式读取大文件的方法
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$lines = []; | |
$handle = fopen('x.txt', "r"); | |
if (!$handle){ | |
exit('error'); | |
} | |
while(!feof($handle)) { | |
$line = trim(fgets($handle)); | |
} | |
fclose($handle); | |
echo 'done'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment