php写入文件做日志
public function dump_log(){ $time = date('Y-m-d'); $file = "mac/".$time.".txt"; $f = fopen($file,"a"); fwrite($f,"----------------------$this->cmd---------------------------"."\n"); fwrite($f,"-----imei-----"."\n".$this->imei."\n"); fwrite($f,"-----cmd-----"."\n".$this->cmd."\n"); fwrite($f,"-----data-----"."\n"); ob_start(); print_r(json_decode(htmlspecialchars_decode($this->data))); $result = ob_get_clean(); fwrite($f,"$result"."\n"); fwrite($f,"-----time-----"."\n".date("Y-m-d H:i:s")."\n\n\n\n"); fclose($f); }