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 . "rn" );
}
fclose ( $handle );
}
}
//使用
$log = new log ();
// $log->addlog (); //不傳值 走默認值
// $log->addlog ( "./log", "a", " 內容1:$content1 內容2: $content2 內容3: $content3 " ); //傳多個內容
// $log->addlog ( "./log", "a", "123,123,123" ); //一次插入並換行