$file = fopen('1.txt', "r"); $data = []; while(! feof($file)) { $content = fgets($file); //逐行取出 $data[] = $content; } fclose($file);
写入文件方法:
file_put_contents($file, $str, FILE_APPEND);
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号