PHP Unsupported operand types

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

  M()->query($sql);
  $result =  M()->query("select found_rows() as count");
  $count = empty($result['0']['count']) ? 0 : (int) $result['0']['count'];//注意这个时候需要提取数组里具体值,而不是直接传数组给到Page类。
  $Page       = new \Think\Page($count, 20);
发布了5 篇原创文章 · 获赞 1 · 访问量 2177

猜你喜欢

转载自blog.csdn.net/liuhuyydy/article/details/100728019