您好,欢迎访问一九零五行业门户网

新人提问:这个有关问题也太诡异了吧关于RSS的基础应用

新人提问:这个问题也太诡异了吧。。关于rss的基础应用
php codechannel['title']; echo 'latest news from ' . $feedtitle . '
'; foreach ($rss->item as $it) { $link = $it['link']; $title = $it['title']; $description = isset($it['description']) ? $it['description'] : ''; echo '' . $title . '
' . $description . '
'; }?>
xml:
(http://localhost/phpproject/rss/rss.xml)
xml code - - xhtmlhttp://localhost/phpproject/newfile.html free web building tutorialsweb developmenten-us2006 w3school.com.cn. all rights reserved. - rss tutorialhttp://localhost/phpproject/newfile.html new rss tutorial on w3schoolservice@w3school.com.cnhttp://localhost/phpproject/newfile.html
1.
为什么运行显示为:
latest news from w3school home page
rss tutorial
new rss tutorial on w3school
后点击rss tutorial后却显示http 403?
2.
在php中的foreach ($rss->item as $it)中的item为什么非要设置items才可以运行成功,否则为
latest news from w3school home page
notice: undefined property: magpierss::$item in d:\apache group\apache2\htdocs\phpproject\index5.php on line 10
warning: invalid argument supplied for foreach() in d:\apache group\apache2\htdocs\phpproject\index5.php on line 10
但我的xml中之内是而非喔。。。。
3.
我修改xml文件之前的中的是“w3school home page”,所以运行时显示为latest news from w3school home page;但修改后却如上所示xhtml,为什么刷新后也显示latest news from w3school home page?
就算重启整个zend studio都继续显示latest news from w3school home page,真不明白。。。。也不关缓存的事啊。。我已经清除了缓存了
麻烦各位帮帮忙。。我还有分加的
------解决方案--------------------
1. 你的代码有问题:
echo '' . $title . '
' . $description . '
';
由于 $link在单引号内所以不会被解析。所以链接也就是 本页链接$link
至于为什么403无权限就要看你的服务器设置。
2. rss标准中规定: a channel may contain any number of s.
xml code ... ......
------解决方案--------------------

探讨
引用:
你怎么修改的。下面这样呢:
echo $title
$description
;
这个不行吗??
echo '' . $title . '
' . $description . '
';
不是说……
其它类似信息

推荐信息