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

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

最近调用网站自动加链接时发现的一个问题,出现了这个错误

翻译一下:不推荐使用each()函数。 此消息将在以后不再显示

原因:php7.2以上废除了each()方法,项目中用到的地方会出现以下报错

The each() function is deprecated. This message will be suppressed on further calls

解决办法,很简单把以下代码

while (list($k,$l) = each($lines)){}

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

更正为:

foreach ($lines as $k => $l){}

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

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

原文链接

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

上一篇:节操播放器拓展之仿微信拖拽关闭视频


下一篇:记录如何发布微信小程序npm包