php7.2报错The each() function is deprecated. This message will be suppressed on furthe

凨影 963

php7.2版本将each()方法废除了,项目中使用到each()的地方会有如下报错:

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in xxx/xxx/xxx.php on line xxx

解决方案也简单,可对应的将 each() 替换为 foreach(),我们看个例子,如下代码是报错行:

while(list($key, $val) = each($para)) { }

修改如下:

foreach($para as $key => $val) {}
联系QQ:77798085 赞助请点这里
全部回复 (0)