Simplepie - 从数据库获取提要

发布于 2024-08-17 07:27:58 字数 1380 浏览 6 评论 0原文

我想从数据库中获取多个提要,这样做

可以从这些提要中获取所有新内容,但有一个问题,我不知道是什么原因导致的,这是代码:

$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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

暮凉 2024-08-24 07:27:58

我发现了问题,是 $feeds[$i] .= $feed_r->feed; 中的点。我必须删除它

I found the problem, it was the dot in $feeds[$i] .= $feed_r->feed; that I had to remove

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文