array(array('host' => '10.169.101.47', 'port' => 11211)), 'prefix' => 'zjcj', 'expire' => 900); $record = isset($_GET["record"]) ? intval($_GET["record"]) : 10; $page = isset($_GET["page"]) ? intval($_GET["page"]) : 1; $cache = new CMemcache($memcache); $ckey = "hqarticle_cache_record" . $record . "_" . $page; $rtn = $cache->get($ckey); if (!$rtn) { $url = 'http://shell.cnfol.com/article/hqarticle.php?classid=1325,1285,1628,1455,1764,1457,1456,1332,1288,1310,2062,2063,1329,1469,1287,2434,1949,1950,1951,1595&title=%E9%97%BD%E7%A6%8F%E5%8F%91A'; if ($record > 0) { $url .='&record=' . $record * $page; } $rtns = getVData($url); $str = "/http\:\/\/(.*?)\.[^(.*?)]/sim"; if (isset($rtns) && !empty($rtns)) { $start = ($page - 1) * $record; $i = 0; if ($start < count($rtns)) { foreach ($rtns as $key => $val) { if ($key == $start) { preg_match($str, $val['Url'], $matches); $rtn['source'][$i]['type'] = $matches[1]; $rtn['source'][$i]['CreatedTime'] = date("Y-m-d H:i:s", $val["CreatedTime"]); $rtn['source'][$i]['ContId'] = $val["ContId"]; $rtn['source'][$i]['Title'] = $val["Title"]; if ($start == $start + $record) { continue; } $start++; $i++; } } unset($rtns); $rtn["rtnCount"]=$i; $cache->set($ckey, $rtn); } else { unset($rtns); $rtn["rtnCount"]=0; } } } header("Content-Type:application/json;charset=UTF-8"); echo json_encode($rtn); exit();