WordPress:Function Reference/get rss

来自站长百科
跳转至: 导航、​ 搜索

Description[ ]

描述[ ]

Retrieves an RSS feed and parses it, then displays it as a list of links. The get_rss() function only outputs the list items, not the surrounding list tags itself.

得到RSS feed并且对其解析,然后将它作为链接列表显示。get_rss()函数只会输出列表items而不是周围的列表标签本身。

Uses the MagpieRSS and RSSCache functions for parsing and automatic caching and the Snoopy HTTP client for the actual retrieval.

使用MagpieRSS 和 RSSCache函数为真正的retrieval解析,自动储存并且Snoopy HTTP client

Note[ ]

[ ]

A bug in 2.06 prevents this function from working correctly. This bug will likely be fixed in 2.07 or 2.08.

2.0.6中的程序错误阻碍了这个函数正常地运行。这个程序错误可能在2.0.7或者2.0.8中得到解决。

Usage[ ]

用法[ ]

%%%<?php require_once(ABSPATH . WPINC . '/rss-functions.php'); get_rss($uri, $num = 5); ?> %%%

%%%<?php require_once(ABSPATH . WPINC . '/rss-functions.php'); get_rss($uri, $num = 5); ?> %%%

Example[ ]

例子[ ]

The get_rss() function only outputs the list items, not the surrounding list tags itself. So, to get and display an ordered list of 5 links from an existing RSS feed:

get_rss()函数只输出列表item,而不输出周围的列表标签本身。因此,得到并且显示现存RSS feed的五个链接的无序列表:

%%%<?php require_once(ABSPATH . WPINC . '/rss-functions.php');

echo '

    '; get_rss('http://example.com/rss/feed/goes/here'); echo '

';

?> %%%

%%%<?php require_once(ABSPATH . WPINC . '/rss-functions.php');

echo '

    '; get_rss('http://example.com/rss/feed/goes/here'); echo '

';

?> %%%

Parameters[ ]

参数[ ]

WordPress:Category:Functions

类别:函数

Output[ ]

输出[ ]

The output from the above example will look like the following:

上述例子的输出内容,看起来像:

%%%

  1. <a href='LINK FROM FEED' title='DESCRIPTION FROM FEED'>TITLE FROM FEED</a>
  2. (repeat for number of links specified)

%%%

%%%

  1. <a href='LINK FROM FEED' title='DESCRIPTION FROM FEED'>TITLE FROM FEED</a>
  2. (repeat for number of links specified)

%%%

Further reading[ ]

深入阅读[ ]