Simplepie - 从数据库获取提要
我想从数据库中获取多个提要,这样做
可以从这些提要中获取所有新内容,但有一个问题,我不知道是什么原因导致的,这是代码:
$feed_sql = mysqli_query($link, “从tutorial_feed中选择feed,其中 已批准=1");
$feeds = array();
$i = 0;
同时($feed_r = mysqli_fetch_object($feed_sql)):
$feeds[$i] .= $feed_r->feed;
$i++;
结束;
$feed = new SimplePie($feeds);
$feed->handle_content_type();
foreach($feed->get_items(0, 100) as $项目):
echo $item->get_permalink()."
";endforeach;
我首先
在第 22 行得到通知:未定义的偏移:0 in I:\wamp\www\cmstut\includes\cron.php
注意:第 22 行 I:\wamp\www\cmstut\includes\cron.php 中未定义偏移量:1
注意:第 22 行 I:\wamp\www\cmstut\includes\cron.php 中未定义偏移量:2
注意:第 22 行 I:\wamp\www\cmstut\includes\cron.php 中未定义偏移量:3
注意:第 22 行 I:\wamp\www\cmstut\includes\cron.php 中未定义偏移量:4
注意:第 22 行 I:\wamp\www\cmstut\includes\cron.php 中未定义偏移量:5
注意:第 22 行 I:\wamp\www\cmstut\includes\cron.php 中未定义偏移量:6
注意:第 22 行 I:\wamp\www\cmstut\includes\cron.php 中未定义偏移量:7
注意:第 22 行 I:\wamp\www\cmstut\includes\cron.php 中未定义偏移量:8
注意:第 22 行 I:\wamp\www\cmstut\includes\cron.php 中未定义偏移量:9
注意:第 22 行 I:\wamp\www\cmstut\includes\cron.php 中的未定义偏移量:10
然后它将开始根据导入的提要打印到新内容的永久链接,我知道未定义的偏移量意味着它不存在,但我不明白,任何帮助将不胜感激
I want to fetch multiple feeds from the database and in so doing fetch all new content from those feeds
it works but there is a problem and I have no idea what's causing it, this is the code:
$feed_sql = mysqli_query($link,
"SELECT feed from tutorial_feed WHERE
approved=1");$feeds = array();
$i = 0;
while($feed_r =
mysqli_fetch_object($feed_sql)):$feeds[$i] .= $feed_r->feed;
$i++;
endwhile;
$feed = new SimplePie($feeds);
$feed->handle_content_type();
foreach($feed->get_items(0, 100) as
$item) :echo $item->get_permalink()."
";endforeach;
I first get
Notice: Undefined offset: 0 in I:\wamp\www\cmstut\includes\cron.php on line 22
Notice: Undefined offset: 1 in I:\wamp\www\cmstut\includes\cron.php on line 22
Notice: Undefined offset: 2 in I:\wamp\www\cmstut\includes\cron.php on line 22
Notice: Undefined offset: 3 in I:\wamp\www\cmstut\includes\cron.php on line 22
Notice: Undefined offset: 4 in I:\wamp\www\cmstut\includes\cron.php on line 22
Notice: Undefined offset: 5 in I:\wamp\www\cmstut\includes\cron.php on line 22
Notice: Undefined offset: 6 in I:\wamp\www\cmstut\includes\cron.php on line 22
Notice: Undefined offset: 7 in I:\wamp\www\cmstut\includes\cron.php on line 22
Notice: Undefined offset: 8 in I:\wamp\www\cmstut\includes\cron.php on line 22
Notice: Undefined offset: 9 in I:\wamp\www\cmstut\includes\cron.php on line 22
Notice: Undefined offset: 10 in I:\wamp\www\cmstut\includes\cron.php on line 22
and then it will start printing the permalinks to the new content based on the imported feeds, I know undefined offset means it does not exist but I don't get it, any help would be appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现了问题,是 $feeds[$i] .= $feed_r->feed; 中的点。我必须删除它
I found the problem, it was the dot in $feeds[$i] .= $feed_r->feed; that I had to remove