fopen(),fwrite() ,fgets() 打开,写入和读取文件

<!--往文件order.txt文件里面添加内容,再输出到浏览器-->

<?php
//$DOCUMENT_ROOT=$_SERVER['DOCUMENT_ROOT'];
$fp=fopen("orders/order.txt",'a'); //打开文件order.txt
if(!$fp){echo "error";}
$content="weeee"."\n "; //定义要写入文件的内容
fwrite($fp,$content); //写入文件order.txt

//$order=fgets($fp);
//echo $order."<br/>";


readfile("orders/order.txt"); //读取整个文件输出浏览器
?>

 

posted on 2010-09-18 17:12  lovening  阅读(732)  评论(0编辑  收藏  举报