Home  >  Article  >  Backend Development  >  PHP file operation class creates files and writes_PHP tutorial

PHP file operation class creates files and writes_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:27:45981browse

if (! empty ( $mode )) {

$this->mode = $mode;

 }

// Determine the written content

 if (! empty ( $content )) {

$this->content = $content;

 }

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

// Split and wrap

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

 foreach ( $string as $v ) {

 fwrite ( $handle, $v . "rn" );

 }

 fclose ( $handle );

 }

 }

//Use

 $log = new log ();

// $log->addlog (); //Do not pass a value and use the default value

  // $log->addlog ( "./log", "a", " Content 1: $content1 Content 2: $content2 Content 3: $content3 " ); // Pass multiple contents

 // $log->addlog ( "./log", "a", "123,123,123" ); //Insert and wrap once

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/814688.htmlTechArticleif (! empty ( $mode )) { $this-mode = $mode; } //Judge writing Content if (! empty ( $content )) { $this-content = $content; } $handle = fopen ( $this-path, $this-mode ); // Split and replace...
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