首頁 >後端開發 >php教程 >PHP 文件操作类创建文件并写入_PHP教程

PHP 文件操作类创建文件并写入_PHP教程

WBOY
WBOY原創
2016-07-13 10:27:451021瀏覽

   if (! empty ( $mode )) {

  $this->mode = $mode;

  }

  //判断写入的内容

  if (! empty ( $content )) {

  $this->content = $content;

  }

  $handle = fopen ( $this->path, $this->mode );

  //拆分换行

  $string = explode ( ",", $this->content );

  foreach ( $string as $v ) {

  fwrite ( $handle, $v . "\r\n" );

  }

  fclose ( $handle );

  }

  }

  //使用

  $log = new log ();

  // $log->addlog (); //不传值 走默认值

  // $log->addlog ( "./log", "a", " 内容1:$content1 内容2: $content2 内容3: $content3 " ); //传多个内容

  // $log->addlog ( "./log", "a", "123,123,123" ); //一次插入并换行

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/814688.htmlTechArticleif (! empty ( $mode )) { $this-mode = $mode; } //判断写入的内容 if (! empty ( $content )) { $this-content = $content; } $handle = fopen ( $this-path, $this-mode ); //拆分换...
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn