警告:json_decode()最多需要2个参数,4个给定

yuh*_*hai 9 php json

我试着像这样使用json_decode:

json_decode($string, true, 100, JSON_BIGINT_AS_STRING);
Run Code Online (Sandbox Code Playgroud)

但我得到了错误:

Warning: json_decode() expects at most 2 parameters, 4 given in /home/content/27/2326027/html/sys/get.php on line 38
Run Code Online (Sandbox Code Playgroud)

任何回应都是适当的

Mār*_*dis 19

好像你的PHP版本不支持这些参数.

见手册:

Version     Description
5.4.0   The options parameter was added.
5.3.0   Added the optional depth. The default recursion depth was increased from 128 to 512
5.2.3   The nesting limit was increased from 20 to 128
5.2.1   Added support for JSON decoding of basic types. 
Run Code Online (Sandbox Code Playgroud)

要使用您编写的代码,您应该至少需要5.4.0版本...

  • 这应该标记为正确的答案 (3认同)