使用Alipay SDK和Php 7.2时报错的解决办法。

我在使用 php7.2 时,Magento2 报错

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

解决之后爆这个错:

count(): Parameter must be an array or an object that implements Countable

提示是这行:

解决之后完整方法是:

  //把while 替换成foreach 
	foreach ($para as $key => $val) {
	$arg.=$key."=".$val."&";
}
//去掉最后一个&字符
//$arg = substr($arg,0,count($arg)-2); // php7.2下count函数的参数只能是数组.
$arg = substr($arg,0,strlen($arg)-1);

有多个两个方法需要替换,请自行搜索