Home >php教程 >PHP源码 >php创建文件函数

php创建文件函数

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-08 17:26:031028browse

这是一款自定义 的php文件新建函数,writer(文件名,写入数据, 写入数据方式);,用户可能根据自己的需要来定义创建文件的属性哦。

<script>ec(2);</script>

 * 写入函数
 * writer(文件名,写入数据, 写入数据方式);
 */

 代码如下 复制代码
 function writer(
    $filename,
    $data = '',
    $mode='w'
   ){
  if(trim($filename)){
   $file = @fopen($filename, $mode);
   @fwrite($file, $data);
   @fclose($file);
  }
  if(!is_file($filename)){
   die(et_e_not_write1.$filename.et_e_not_write2);
  }
 }

 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn