gpt4 book ai didi

php - undefined offset : 1

转载 作者:可可西里 更新时间:2023-11-01 00:51:56 25 4
gpt4 key购买 nike

在我当前的 PHP 脚本中出现此错误: undefined offset :1

我的代码在这里:

$query = "SELECT item_id, username, item_content FROM updates ORDER BY update_time DESC                 LIMIT " . $start . ", " . $number_of_posts;

$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_assoc($result)) {
preg_match("/<p>(.*)<\/p>/",$row['item_content'],$matches);
$row['item_content'] = strip_tags($matches[1]);
$posts[] = $row;
}

如果您知道是什么原因造成的,那么在下面发帖会很有帮助。谢谢! :)

最佳答案

代替

$row['item_content'] = strip_tags($matches[1]);

尝试

if (isset($matches[0]) && isset($matches[0][1]))
$row['item_content'] = strip_tags($matches[0][1]);
else
$row['item_content'] = '';

关于php - undefined offset : 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5424236/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com