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