如何通过iOS访问参数发送参数

时间:2016-04-02 06:38:33

标签: php ios

我从iOS端API发送数据,如

    {
    "broker_name" : " test 2",
    "concession" : 2,
    "doller_rate" : 70,
    "due_day" : 30,
    "party_name" : "Test",
    "payment_amount" : "274.4",
    "payment_date" : "02 May 2016",
    "rate" : 0,
    "sale_date" : "02 April 2016",
    "serial_number" : "Test 1",
    "transection_type" : 1,
    "user_id" : 2,
    "weight" : [{
            "carat_rate" : 2,
            "carat_weight" : 2,
            "sub_serial_Note" : "d",
            "total" : "4.0",
         },
         {
            "carat_rate" : 4,
            "carat_weight" : 4,
            "sub_serial_Note" : "k",
            "total" : "16.0"
        }]
}

如何在PHP中访问此参数并使用字典访问右侧数组。

1 个答案:

答案 0 :(得分:-1)

你想在变量上获得json

$json_get = $_REQUEST['yoursenddata'];

然后将此数据解码为数组

$json_array=json_decode($json);
print_r($json_array);
$broker = $json_array['broker_name'];

其他人也一样。