<?php header('Content-type:text/html;charset=utf-8'); function songshu() { $data = array(); $url = 'http://songshuhui.net/feed'; $result = file_get_contents($url); $xml = simplexml_load_string($result, 'SimpleXMLElement', LIBXML_NOCDATA); for ($i = 0; $i < 6; $i++) { array_push($data, array('title' => $xml->channel->item[$i]->title, 'description' => $xml->channel->item[$i]->description, 'link' => $xml->channel->item[$i]->link)); } return $data; } print_r(songshu());
} } exit(W::response($xml, $data, 'news')); break; case 8: $res = yyets(); $data = array(array('title' => '人人影视', 'cover' => $web . '/img/yyets.png')); for ($i = 0; $i < count($data); $i++) { if ($res[$i]) { array_push($data, array('title' => $res[$i]['title'], 'note' => $res[$i]['description'], 'cover' => $res[$i]['cover'], 'link' => $res[$i]['link'])); } } exit(W::response($xml, $data, 'news')); break; case 9: $res = songshu(); $data = array(array('title' => '科学松鼠会', 'cover' => $web . '/img/songshu.gif')); for ($i = 0; $i < count($data); $i++) { if ($res[$i]) { array_push($data, array('title' => $res[$i]['title'], 'note' => $res[$i]['description'], 'link' => $res[$i]['link'])); } } exit(W::response($xml, $data, 'news')); break; case 10: $res = ifanr(); $data = array(array('title' => '爱范儿 · Beats of Bits', 'cover' => $web . '/img/ifanr.gif')); for ($i = 0; $i < count($data); $i++) { if ($res[$i]) { array_push($data, array('title' => $res[$i]['title'], 'note' => $res[$i]['description'], 'cover' => $res[$i]['cover'], 'link' => $res[$i]['link'])); }