//计算总页数 $zPage = ceil($zNum / $this->num); $this->jsonArr = array('num' => $this->num, 'page' => (int) $this->page + 1, 'zNum' => $zNum, 'zPage' => $zPage, "s" => "{$this->key}", 'other' => array('author' => 'JAE', 'QQ' => '734708094', 'blog' => 'http://blog.jaekj.com'), 'data' => $this->jsonArr); } public function getJSON() { return json_encode($this->jsonArr); } private function getBaiduRealURL($url) { //得到百度跳转的真正地址 $header = get_headers($url, 1); if (strpos($header[0], '301') || strpos($header[0], '302')) { if (is_array($header['Location'])) { //return $header['Location'][count($header['Location'])-1]; return $header['Location'][0]; } else { return $header['Location']; } } else { return $url; } } private function getGoogleRealURL($url) { $reg_url = '/q=(.+)&/U'; return preg_match($reg_url, $url, $arr) ? urldecode($arr[1]) : $url; } } $hj = Searcher::S('site:pan.baidu.com torrent', 'sogou', 20, 2); print_r($hj->jsonArr);