使用PHP,如何插入一行有效的结束一个非常大的.txt文件


Using PHP,how to insert a line efficient to the end of a very large .txt file

.txt文件大约500M,当我使用fopen时,我的电脑无法工作,所以我想用其他方法来完成任务

Try

 $fp = fopen( "file.txt", 'a' );
 fwrite( $fp, "'n" );
 fclose( $fp );

如果你在Linux上运行PHP脚本,你可以这样做:

$newLine  = 'some text';
$filename = 'large.txt';
system('echo "' . $newLine . '" >> ' . $filename);