setTitle(Site::name()); $feed->setLink(Site::indexUrl()); $feed->setDescription(Site::desc()); //It's important for RSS 1.0 $feed->setChannelAbout(Site::keywords()); // An image is optional. $feed->setImage(Site::logo(), 'PHP武器库头像', get_source_link('/')); //Adding a feed. Generally this portion will be in a loop and add all feeds. $list_post = Site::mapRecentlyPost(); foreach ($list_post as $model_post) { //Create an empty FeedItem $new_item = $feed->createNewItem(); $new_item->setTitle($model_post->title); $new_item->setLink($model_post->read_url); //The parameter is a timestamp for setDate() function $new_item->setDate($model_post->publish_time); $new_item->setDescription($model_post->desc); //Use core addElement() function for other supported optional elements //Now add the feed item $feed->addItem($new_item); } $content = $feed->generateFeed(); return $content; } }