特定のタグが該当する場合にのみ、特定のフィード ソースからフィード ニュースを取得したいと考えています。
$category は文字列ではないため、取得できません。したがって、strschr は返されません。(だから私は信じています)。
function ultimasNoticiasBlog()
{
$channel = new Zend_Feed_Rss('http:/something.com/?feed=rss2');
$news = array();
foreach ($channel as $item) {
foreach ($item->category as $category)
{
//if any of the news has the tag "Sugestão"
if (strchr($category,'Sugestão'))
{
$news['find'] = "I have found a feed with your tag";
}
else
{
echo 'Found Nothing';
}
}
return $news;
}
}
ただし、次のようにすると、echo $category" ビューポートにすべてのカテゴリが出力されます。
ここに来ていないのは何ですか?アドバイスをください、MEM
更新: 簡単に言えば:
もしそうなら:
var_dump($category);
私は得る:
object(Zend_Feed_Element)#159 (3) {
["_element:protected"]=>
object(DOMElement)#165 (0) {
}
["_parentElement:protected"]=>
NULL
["_appended:protected"]=>
bool(true)
}
object(Zend_Feed_Element)#156 (3) {
["_element:protected"]=>
object(DOMElement)#166 (0) {
}
["_parentElement:protected"]=>
NULL
["_appended:protected"]=>
bool(true)
}
もしそうなら: echo $category;
ビューポートに乗ります:SugestaoAnotherTag1AnotherTag2 ...
理由がわかりません。さらに重要なことに、「スゲスタオがそうであるかどうか」を確認する方法がわかりません。:s