0
How can Paste the files to each other with php?
2 ответов
+ 3
If you have two files (file1.txt, file2.txt) and you want to get the content of the first one and put it at the end of the second one, you have to:
1. read the content of first file
2. open the second file
3. append the content of first file to second file
4. close the second file
$file1 = file('file1.txt');
$file2 = fopen('file2.txt', 'a');
foreach ($file1 as $line) {
fwrite($file2, $line.'\n');
}
fclose($file2);
0
thanks so much