且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在PHP中创建嵌套的JSON对象?

更新时间:2023-11-30 12:46:16

可以通过以下PHP代码创建此JSON结构

this JSON structure can be created by following PHP code

$json = json_encode(array(
     "client" => array(
        "build" => "1.0",
        "name" => "xxxxxx",
        "version" => "1.0"
     ),
     "protocolVersion" => 4,
     "data" => array(
        "distributorId" => "xxxx",
        "distributorPin" => "xxxx",
        "locale" => "en-US"
     )
));

请参见 json_encode