Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我不想将所有行保存在 1 个文件中(使用 file_put_content),而是保存几个文件,每个文件包含一定数量的行。作为 file1.txt file2.txt
我有这个代码:
$file = foreach($rows as $row) { $row['domain'] } file_put_contents("file.txt", $file, LOCK_EX);
像这样做
<?php $i=1; foreach($rows as $row) { file_put_contents('file' . $i . '.txt', $row['domain'], LOCK_EX); $i++; }