php简易的文件读写

文件读写可以做到很多事情,比方说模版机制,基本都是这个逻辑,可能在代码方面的优化各有千秋.

$sFile = file_get_contents("adocode.txt", False, $cxContext);

 $sFile= str_replace('php','html',$sFile);

  $ff= fopen('files/'.time().".xml","w+");  //制定目录读取或者生成 w+ 即不存在会生成. 和创建的逻辑

 fwrite($ff,$sFile);

 fclose($ff);

 

 

http://blog.zl5.info/php-read-write

posted @ 2012-09-21 15:53  ado-geek  阅读(194)  评论(0编辑  收藏  举报