more work with file io
This commit is contained in:
parent
15b891ff97
commit
e39e9cc091
@ -13,6 +13,7 @@ mkheader('files!', '#aaa');
|
||||
// do nothing!
|
||||
$handle = fopen('data.txt', 'r');
|
||||
fclose($handle);
|
||||
print "didn't actually do anything here ...";
|
||||
|
||||
?></pre>
|
||||
|
||||
@ -25,5 +26,19 @@ mkheader('files!', '#aaa');
|
||||
|
||||
?></pre>
|
||||
|
||||
|
||||
<!-- ======================================================= -->
|
||||
<pre><?php
|
||||
|
||||
$lines = file('data.txt');
|
||||
|
||||
foreach($lines as $key => $line) {
|
||||
$linenum = $key + 1;
|
||||
print "Line $linenum: $line";
|
||||
}
|
||||
|
||||
|
||||
?></pre>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user