Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| snippets:php:fgets [26-Jan-2021 19:40] – Steve Joynt | snippets:php:fgets [02-Feb-2025 16:14] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| <file php> | <file php> | ||
| - | function fred() { | + | $filename = ' |
| - | return true; | + | |
| + | $fh = @fopen($filename, ' | ||
| + | |||
| + | if ( ! $fh ) { | ||
| + | throw new Exception(" | ||
| } | } | ||
| + | while ( ( $text = fgets($fh) ) !== false ) { | ||
| + | echo $text; | ||
| + | } | ||
| </ | </ | ||