- PHP code
channel['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
-
RSS Tutorial http://localhost/PHPProject/NewFile.htmlNew RSS tutorial on W3School service@w3school.com.cnhttp://localhost/PHPProject/NewFile.html
-- XHTML http://localhost/PHPProject/NewFile.htmlFree web building tutorials Web development en-US 2006 w3school.com.cn. All rights reserved. -
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文件之前的
就算重启整个zend studio都继续显示Latest News from W3School Home Page,真不明白。。。。也不关缓存的事啊。。我已经清除了缓存了
麻烦各位帮帮忙。。我还有分加的
------解决方案--------------------
1. 你的代码有问题:
echo '
' . $title . '
' . $description . '
由于 $link在单引号内所以不会被解析。所以链接也就是 本页链接$link
至于为什么403无权限就要看你的服务器设置。
2. RSS标准中规定: A channel may contain any number of
- XML code
- ...
- ...
...
------解决方案--------------------