create nested JSON object in php?

后端 未结 7 819
广开言路
广开言路 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 16:55

    User array to get the correct format and then call echo json_encode(array)

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

提交回复
热议问题