PHP Reading A File |and| Writing To A File
阿里云国内75折 回扣 微信号:monov8 |
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6 |
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
阿里云国内75折 回扣 微信号:monov8 |
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6 |