Closed ghost closed 3 years ago
环境: MacOS Big Sur + Nginx + PHP-FPM,使用 php think run 启动调试。
PHP 7.3.27 (cli) (built: Feb 27 2021 18:04:51) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.27, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.3.27, Copyright (c) 1999-2018, by Zend Technologies
hexdec($body->constant_result[0]) 报错,打印结果大概是:1.123456E+6,然后 Utils::toDisplayAmount 方法里报错了,临时解决方案如下:
$balance = Utils::toDisplayAmount(hexdec($body->constant_result[0]), $this->decimals); to: $balance = Utils::toDisplayAmount(number_format(hexdec($body->constant_result[0]), 0, '', ''), $this->decimals);
解决科学计数法数字格式问题tag1.3.0
环境: MacOS Big Sur + Nginx + PHP-FPM,使用 php think run 启动调试。
PHP 7.3.27 (cli) (built: Feb 27 2021 18:04:51) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.27, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.3.27, Copyright (c) 1999-2018, by Zend Technologies
hexdec($body->constant_result[0]) 报错,打印结果大概是:1.123456E+6,然后 Utils::toDisplayAmount 方法里报错了,临时解决方案如下:
$balance = Utils::toDisplayAmount(hexdec($body->constant_result[0]), $this->decimals); to: $balance = Utils::toDisplayAmount(number_format(hexdec($body->constant_result[0]), 0, '', ''), $this->decimals);