PHP7.1以上版本 count()报错及解决方法

报错信息:count(): Parameter must be an array or an object that implements Countable (View: -----------------.php) 简单来说, 就是7.2版本起,count()函数中的参数必须是数组或者对象。

建议:在使用count函数计数之前,使用is_*来判断具体的类型,不是此类型使用强制转换 (array)或者抛出异常 try catch,之后在使用 count函数进行计数

猜你喜欢

转载自blog.csdn.net/weixin_44000238/article/details/107482629