0

How can Paste the files to each other with php?

12th May 2017, 2:33 AM
vtm
vtm - avatar
2 Antworten
+ 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);
16th May 2017, 10:11 AM
Krzysztof Przybylowski
Krzysztof Przybylowski - avatar
0
thanks so much
17th May 2017, 7:29 AM
vtm
vtm - avatar