function get($url = NULL) { if ($url == NULL) { $url = "http://news-at.zhihu.com/api/3/news/latest"; } parent::$handle = fopen($url, "rb"); if (parent::$handle) { return parent::read(); } else { return false; } }
<?php require "header.php"; ?> <?php $id = test_input($_GET['av']); if (strlen($id) == 0 || !is_numeric($id)) { header("location:index.php"); } else { $im = infoMgr::getInstance(); $tm = new detailMgr($im); $gb = new getBase(); $url = new urlMgr(); $urlAvailable = $url->getContextUrl($id); $jsonData = $tm->getJSON($gb, $urlAvailable); $jsonArray = $tm->getContext(new decodeJSON($jsonData)); $dataParser = new DataObj($jsonArray, DataObj::BODY); $stories = $dataParser->getSingleNew(); if (!$stories) { header("location:index.php"); } else { //print_r($stories); //echo $dataParser->getImages(); $allContents = $dataParser->getBody(); $newsTitle = $dataParser->getTitle(); $keyTitle = array("整", "点", "儿", "新", "闻"); $flag = 0; foreach ($keyTitle as $key => $value) { if (stripos($newsTitle, $value)) { $flag++;