1
0
mirror of https://github.com/php/web-php.git synced 2026-03-30 11:12:09 +02:00
Files
archived-web-php/apachecon/s_filehandling2.php3
Rasmus Lerdorf 2424277ad8 Add main slides
1998-10-21 23:44:28 +00:00

31 lines
531 B
PHP
Executable File

<?php require "header.inc"?>
<H1>C-like File Handling</H1>
<H4>Reading from a file</H4>
<?example('<?php
$file = fopen("sample.txt", "r");
while (!feof($file)) {
echo fgetss($file, 1024), "<BR>";
}
?>');?>
<H6>Output:</H6><BLOCKQUOTE>
<h6>
<?php
$file = fopen("sample.txt", "r");
while (!feof($file)) {
echo fgetss($file, 1024), "<BR>";
}
?>
</h6>
</BLOCKQUOTE>
<H4>Writing to a file</H4>
<?example('<?php
$file = fopen("agent.log", "a");
fputs($file, $HTTP_USER_AGENT."\n");
?>');?>
</UL>
<?php require "footer.inc"?>