create nested JSON object in php?

后端 未结 7 813
广开言路
广开言路 2020-12-09 16:25

I don\'t work with php much and I\'m a little fuzzy on object creation. I need to make a webservice request sending json and I think I have that part covered. Before I can

7条回答
  •  北海茫月
    2020-12-09 17:01

    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"
         )
    ));
    

    see json_encode

提交回复
热议问题