PHP Unsupported operand types
2022-07-28 15:09:43
102
{{single.collect_count}}

开发分组后分页时,发现报错【Unsupported operand types】此报错为不支持的操作数据类型,这是因为将不符合数据类型的数据传送给了某些函数。尤其是容易出现在将一个数组传给了一个函数,这个函数应该接受的参数是数字。

M()->query($sql);$result =M()->query("select found_rows() as count");//注意这个时候需要提取数组里具体值,而不是直接传数组给到Page类。$count = empty($result['0']['count']) ? 0 : (int) $result['0']['count'];$Page = new \Think\Page($count, 20);
回帖
全部回帖({{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 ? '加载中...' : '查看更多评论'}}