file = Dever::path(Dever::data() . 'logs/', 'spider/' . $key); } public function get() { $content = file_get_contents($this->file); return $content; } public function add($string) { $time = Dever::msectime(); if ($this->time == 0) { $hs = 0; $this->time = $time; } else { $hs = $time - $this->time; } $time = date('Y-m-d H:i:s'); $content = array ( '时间:' . $time, '耗时:' . $hs . 'MS', '内容:' . str_replace("\n", '<--', $string), ); $this->content[] = implode(' ', $content); } public function out() { print_r(Dever::table($this->content)); } public function save() { $content = implode("\r\n", $this->content); file_put_contents($this->file, $content, FILE_APPEND); } }