2012-09-21 124 views

回答

7

这是目前被带到了一个PHP错误:

错误报告https://bugs.php.net/bug.php?id=50224

在未来,有可能是功能通过options参数的标志更严格的分型。然而,现在,用引号括起来就足够了。

+0

感谢您的回复和链接! –

+0

从PHP 7.0开始固定,可用于json_decode的新选项'JSON_PRESERVE_FRACTIONAL_PART' –

0
number_format($number, 2) 

通过那个输出数字?

1

我不认为这是可能的!

1
//convert the json to a string before json_decode 
$res = preg_replace('/next_cursor":(\d+)/', 'next_cursor":"\1"', $json); 
0

可以使用JSON_BIGINT_AS_STRING选项,例如:虽然

$json = json_decode($input, true, 512, JSON_BIGINT_AS_STRING); 

小心,这仅适用于PHP 5.4+!