Parsing SimplePie RSS解析器-即使在UTF-8上也可以对奇怪的字符进行编码
我使用SimplePie解析RSS提要,并获得以下输出:Parsing SimplePie RSS解析器-即使在UTF-8上也可以对奇怪的字符进行编码,parsing,encoding,utf-8,rss,simplepie,Parsing,Encoding,Utf 8,Rss,Simplepie,我使用SimplePie解析RSS提要,并获得以下输出: Don't forget our "Spot It, Post It" ..... 我的代码是: <?php header('Content-type:text/html; charset=utf-8'); require_once('rss/simplepie.inc'); // We'll process this feed with all of the default
Don't forget our "Spot It, Post It" .....
我的代码是:
<?php
header('Content-type:text/html; charset=utf-8');
require_once('rss/simplepie.inc');
// We'll process this feed with all of the default options.
$feed = new SimplePie();
// Set which feed to process.
$feed->set_feed_url('FeedURL');
$feed->enable_cache(true);
$feed->set_cache_duration(3600);
$feed->set_cache_location('cache');
$feed->init();
$feed->handle_content_type();
?>
每个提要都会发生这种情况吗?或者只是一个特定的提要?可能是饲料本身。如果说明本身有问题,可以使用$item->get_content()直接查看提要的内容。有时需要对来自提要或web API的信息进行处理,有PHP代码和用于剥离和替换字符的示例,SimplePie站点上的News Blocks 2.0演示有一些我最近经常使用的清理代码
祝你好运。每次喂食都会发生这种情况吗?或者只是一个特定的提要?可能是饲料本身。如果说明本身有问题,可以使用$item->get_content()直接查看提要的内容。有时需要对来自提要或web API的信息进行处理,有PHP代码和用于剥离和替换字符的示例,SimplePie站点上的News Blocks 2.0演示有一些我最近经常使用的清理代码
祝你好运。我不知道你是否已经解决了这个问题,但我想我会与其他任何正在寻找的人分享我的解决方案。我也有同样的问题-角色在提要中被“破坏”。我最初的代码(有问题)是:
看到上面的帖子,我试着添加下面的标题,结果成功了
<?php
header('Content-type:text/html; charset=utf-8');
include_once $_SERVER['DOCUMENT_ROOT'] . '/inc/simplepie.inc';
$feed = new SimplePie('http://domain.wordpress.com/feed/');
?>
我希望这能帮助其他遇到同样问题的人。我不知道您是否已经解决了这个问题,但我想我会与其他正在寻找的人分享我的解决方案。我也有同样的问题-角色在提要中被“破坏”。我最初的代码(有问题)是:
看到上面的帖子,我试着添加下面的标题,结果成功了
<?php
header('Content-type:text/html; charset=utf-8');
include_once $_SERVER['DOCUMENT_ROOT'] . '/inc/simplepie.inc';
$feed = new SimplePie('http://domain.wordpress.com/feed/');
?>
我希望这能帮助其他遇到同样问题的人