Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
dvprog_09 [2017-09-01 13:40] Daniel Viström |
dvprog_09 [2022-07-18 13:20] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Genomgång | + | ====== Genomgång - Att läsa från och skriva till textfiler ====== |
<php> | <php> | ||
Line 20: | Line 20: | ||
| | ||
*/ | */ | ||
- | include(' | + | include ' |
// Skriver till en textfil. Finns inte filen skapas den. FILE_APPEND gör att innehåll läggs till och inte skrivs över. | // Skriver till en textfil. Finns inte filen skapas den. FILE_APPEND gör att innehåll läggs till och inte skrivs över. | ||
Line 28: | Line 28: | ||
// Läser en textfil till en sträng. | // Läser en textfil till en sträng. | ||
$str = file_get_contents($textfil); | $str = file_get_contents($textfil); | ||
- | echo nl2br($str) . '< | + | echo nl2br($str) . '< |
// Läser in en textfil till en array, radbrytning ger ny " | // Läser in en textfil till en array, radbrytning ger ny " | ||
Line 47: | Line 47: | ||
} | } | ||
- | include(' | + | include ' |
</ | </ | ||