M3 SR+ deep bleuMidnight grey/ Black /areo Bestel 19/8 restrictie 1/11 vin 11-12 aflevering 14-12
Je initialiseerd $write_to_file als een string, maar gebruikt hem vervolgens als een array.
Ken Thompson's famous line from V6 UNIX is equaly applicable to this post:
'You are not expected to understand this'
PHP:
1
| <?$input_file_array = file("inputfile.txt");$fp = fopen("outputfile", "a");while (list ($key, $regel) = each ($input_file_array)) { fputs($fp, $regel);}fclose($fp);?> |
of om 1 regel toe te voegen
PHP:
1
| <?$fp = fopen("outputfile", "a");fputs($fp, $output_string);?> |
de "a" staat dus voor append (toevoegen). Als het bestand niet bestaat, wordt het geprobeerd aan te maken.
SIZE does matter.
"You're go at throttle up!"
Verwijderd
Is dat niet zoiets als
PHP:
1
| <?$fp = fopen("tekst.txt", "a+");foreach($tekst_array as $tekst_regel) fwrite = ($fp, $tekst_regel."\n");fclose($fp);?> |
"a+" is voor zowel lezen als schrijven, in dit geval dus niet nodig.
zie:
http://www.php.net/manual/en/function.fopen.php
zie:
http://www.php.net/manual/en/function.fopen.php
SIZE does matter.
"You're go at throttle up!"
Pagina: 1