php升级之后,遇到的错误提示如下:
Deprecated: The each() function is deprecated. This message will be
suppressed on further calls in
/home/wwwroot/站点名称/plugins/content/breezingforms/breezingforms.php on
line 192
报错原因:
Warning
本函数已自 PHP 7.2.0 起废弃。强烈建议不要使用本函数。
使用此函数遍历时,比普通的 foreach 更慢, 并且给新语法的变化带来实现问题。因此它被废弃了。
参考官网网址:https://www.php.net/manual/zh/function.each.php
解决方案
参考官网网址:https://www.php.net/manual/zh/control-structures.foreach.php
<?php
$arr = array("one", "two", "three");
reset($arr);
while (list($key, $value) = each($arr)) {
echo "Key: $key; Value: $value<br />\n";
}
foreach ($arr as $key => $value) {
echo "Key: $key; Value: $value<br />\n";
}
?>
替换为foreach函数,可以解决