$sum = $end; $file_name = "/home/pzr/download/2016-05-04-audio/{$start}-{$end}"; $this->logger("start ", $file_name); $data = $this->read_file_json($file_name); $this->read_json($data); $this->write_url_json($start, $end); $this->logger('ended ', $file_name); } } public function logger($key, $value, $line = false) { @error_log("\n {$key} : " . $value, 3, '/tmp/tourism.log'); if ($line) { @error_log("\n------------------------------------------------------\n", 3, '/tmp/tourism.log'); } } public function write_url_json($start, $end) { $imgPath = $this->imgPath . "img{$start}-{$end}.json"; $mp3Path = $this->mp3Path . "mp3{$start}-{$end}.json"; $this->logger("{$start}-{$end} :", count($this->picArray)); $this->logger("{$start}-{$end} :", count($this->mp3Array)); file_put_contents($imgPath, json_encode($this->picArray)); file_put_contents($mp3Path, json_encode($this->mp3Array)); } } $mp3Path = '/home/pzr/download/2016-05-08/'; $imgPath = '/home/pzr/download/2016-05-08/'; $tourism = new tourism($mp3Path, $imgPath); $tourism->start();