PHP ECSHOP中 诡异的问题:expects parameter 1 to be double

使用Ecshop给客户做了一个商城系统,在测试时发现后台在更改订单的配送方式时出现了以下问题
“PHP Warning: number_format() expects parameter 1 to be double, string given in C:inetpubwwwrootincludeslib_common.php on line 973”


在查看源码的时候并没有发现问题,然后就把$price的打印了出来也没有发现问题,此时$price的值为:string(4) "0.10"

最后在网络上了解到解决方案:
先将值转换成数值类型,然后再使用number_format方法,第938行
但奇怪的是在number_format方法里直接使用string类型并没有任何问题,即使string的值无法完全转换成数值类型也不会出错
如下面的"2s5.689sf"直接转换成2.00,且没有出现问题



参考:
     




原文地址:https://www.cnblogs.com/huangtailang/p/e38f2522c0f532983b6c009a00251dec.html