本文主要是介绍Warning: count(): Parameter must be an array or an object that implements Countable快速解决方法,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Warning: count(): Parameter must be an array or an object that implements Countable。
解决thinkphp3项目在开发时弹出一个警告Warning: count(): Parameter must be an array or an object that implements Countable。
这说明count()参数必须是一个数组或一个对象,和前面warning: a non-numeric value encountered in line错误类似,都是php7版本引起的。版本更新后,部分方法会变得更加严谨,传递一个无效参数的时候,count()函数抛出warning的警告
由此看来提示count()参数必须是一个数组或一个对象,直接将它设为数组试试,原来报错代码行:
count( d i s c o u n t l i s t ) , 改 为 : c o u n t ( ( a r r a y ) discount_list) ,改为:count((array) discountlist),改为:count((array)discount_list)
保存并清除缓存,错误提示消失。
这样看来,这个问题看来根据报错提示就可以调整,希望这篇文章能够给大家带来小小的帮助。
这篇关于Warning: count(): Parameter must be an array or an object that implements Countable快速解决方法的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!