Maison > Article > développement back-end > 新人提问:这个有关问题也太诡异了吧。关于RSS的基础应用
新人提问:这个问题也太诡异了吧。。关于RSS的基础应用
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?php require_once('magpierss/rss_fetch.inc'); $url = "http://localhost/PHPProject/RSS/RSS.xml"; $rss = fetch_rss($url); $feedTitle = $rss->channel['title']; echo '<p>Latest News from <strong>' . $feedTitle . '</strong></p>'; foreach ($rss->item as $it) { $link = $it['link']; $title = $it['title']; $description = isset($it['description']) ? $it['description'] : ''; echo '<p><a href="%5C%22%24link%5C%22">' . $title . '</a><br>' . $description . '</p>'; }?>
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> <?xml version="1.0" encoding="UTF-8" ?> - <rss version="2.0">- <channel> <title>XHTML</title> <link>http://localhost/PHPProject/NewFile.html <description>Free web building tutorials</description> <category>Web development</category> <language>en-US</language> <copyright>2006 w3school.com.cn. All rights reserved.</copyright> - <item> <title>RSS Tutorial</title> <link>http://localhost/PHPProject/NewFile.html <description>New RSS tutorial on W3School</description> <author>[email protected]</author> <comments>http://localhost/PHPProject/NewFile.html</comments> </item> </channel> </rss>
' . $title . '
' . $description . '
<channel> ... <item>...</item> <item>...</item> <!-- 可能有多个 --></channel><br><font color="#e78608">------解决方案--------------------</font><br>