各位大虾们:
我因为要用到$rss =& new XML_RSS("")这条语句,专门去http://pear.php.net下载了
XML_RSS以及XML_Parse包,解压后分别得到了两个不知道啥类型的文件,我将解压得到的文件放到
根目录的Pear文件夹,然后运行,它还是提示“找不到Class XML_RSS”.请问我这样操作哪儿不对?是不是要require_once(???),这个require_once ()该怎么写???
我因为要用到$rss =& new XML_RSS("")这条语句,专门去http://pear.php.net下载了
XML_RSS以及XML_Parse包,解压后分别得到了两个不知道啥类型的文件,我将解压得到的文件放到
根目录的Pear文件夹,然后运行,它还是提示“找不到Class XML_RSS”.请问我这样操作哪儿不对?是不是要require_once(???),这个require_once ()该怎么写???
pear install XML_RSS-1.0.0
你解压缩做啥
多看文档
pear install xxx
你说的不要解压,去php目录下运行命令,是用什么东西去运行?go-pear.bat吗?另外,我运行完了命令该做什么??这个XML_RSS-1.0.0在程序中需不需要包含进来??
<?php
// include class
include ("RSS.php");// download and parse RSS data
$rss =& new XML_RSS("http://techrepublic.com.com/5150-22-0.xml");
$rss->parse();// print headlines
print_r($rss->getItems());
?>
我之前的代码和你的一模一样的,他会提示 Class 'XML_RSS' not found
这也不奇怪,因为我确实没安装XML_RSS,所以include ("RSS.php")也没用啦。
问题的关键是:这个XML_RSS包 和XML_Parse包下载了后那怎么弄,然后把它们放在哪个目录下,才能使得
include ("RSS.php")这句话合法
上面已经有答案了 pear install 命令行 安装
我按你说的去做了,我去 cmd那里 pear了,然后我找到了RSS.php的路径,
我就include ("C:\Documents and Settings\Administrator\Local Settings\Temp\pear\download\XML_RSS-1.0.0\XML\RSS.php");它怎么又有新错
Warning: require_once(XML/Parser.php) [function.require-once]: failed to open stream: No such file or directory in C:\Documents and Settings\Administrator\Local Settings\Temp\pear\download\XML_RSS-1.0.0\XML\RSS.php on line 17Fatal error: require_once() [function.require]: Failed opening required 'XML/Parser.php' (include_path='.;C:\php5\pear') in C:\Documents and Settings\Administrator\Local Settings\Temp\pear\download\XML_RSS-1.0.0\XML\RSS.php on line 17
不过在这里,我要告诉其它新手,pear命令可以使用的前提是要更改配置文件,详情请参考
http://tech.ddvip.com/2008-11/122611717390438.html。
另一种是下载*.tgz文件,然后直接安装.