document.txt
this is the first line.
this is the second line.
this is the fourth line.
getfile.php
<?php
//header('Content-Type: text/plain');
$file = "./document.txt";
$document = file_get_contents($file);
echo $document;
$lines = explode("\n",$document);
foreach($lines as $newline){
echo '<b>' . $newline . '</b><br>';
}
?>
fileput.php
<?php
$file = "./lines.txt";
$write = "this is line one\n";
file_put_contents($file,$write);
//file_put_contents($file,$write,FILE_APPEND);
?>
php -> fwrite()
<?php
//file write
//$h = fopen('data.txt','w+');
//fwrite($h,'hello zxl');
?>
-->data.txt
==>hello zxl