Thinkphp出现了'未定义数组下标: 0'的错误解决方法
2022-11-24 11:10:29
188
{{single.collect_count}}

未定义数组下标
今天在ajax中加了一个数据项目,不知道为啥, 报错了’未定义数组下标: 0’, 搞了半天. 然后找到了一个方法.
未定义数组下标
未定义数组下标
就是在模块下的公共函数文件common.php函数外加入以下代码排除
‘未定义数组下标: 0’

error_reporting(E_ERROR | E_WARNING | E_PARSE);

然而error_reporting()函数主要用显示哪些错误.

还有一个方法, 就是将下标改成这样, 而且是推荐这种方法.

$banner = ['0' => '0',........]
回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}