开发者

PHP Parsing Question

开发者 https://www.devze.com 2023-02-03 08:31 出处:网络
If I am parsing an rss feed with php and xml, how can I parse more than one feed using one fopen statement. I am currently storing the feeds in different variables, and my fopen statement looks like t

If I am parsing an rss feed with php and xml, how can I parse more than one feed using one fopen statement. I am currently storing the feeds in different variables, and my fopen statement looks like this:

$fp=fopen($feedzero, $feedone, $feedtwo, "r") 

When I run the code, I get this开发者_StackOverflow中文版 error:

fopen() expects parameter 4 to be resource, string given

Any help appreciated.


http://php.net/manual/en/function.fopen.php explains a bit about fopen function. also using http://framework.zend.com/manual/en/zend.feed.consuming-rss.html would save you from bug hunting


You can't. You'll have to open the files using separate handles and iterate over them separately.

$feedoneFp = fopen($feedone, 'r');
$feedtwoFp = fopen($feedtwo, 'r');
$feedthreeFp = fopen($feedthree, 'r');


fopen expects parameter 4 to be a resource. You gave it a string. It looks like you may have meant to pass in a mode representing "read-only". Mode is the 2nd parameter, not the 4th.

0

精彩评论

暂无评论...
验证码 换一张
取 消