PHP学习记录之文件的处理一
fopen打开一个文件如果没有的话就重新创建,如果有的话就直接删除里面的内容.fclose关闭一个文件fwrite把内容写入到文件.file_put_contentsPHP5中用到写入一句简单的话的时候用.
<?php
 $fp=fopen('file.txt','w');
 $outputstring='我将要被写入进去了';
 fwrite($fp,$outputstring,strlen($outputstring));
fclose($fp);
?>
//file_put_contents的用法
file_put_contents('file2.txt',"继续被写入进去'\r\n写进去吧");
                    
                
                
            
        
浙公网安备 33010602011771号