0

嗨,我正在尝试将所有内容都放在 [] 括号内。我已经尝试了我能找到的一切,但没有运气

{
  "Items": [
    {
      "UID": "XXX-XXX",
      "Code": "USD",
      "CurrencyName": "US Dollar",
      "CurrencyRate": 0.71428000,
      "URI": "https://ar2.api.myob.com/accountright/XXX-XXX/GeneralLedger/Currency/XXX-XXX",
      "RowVersion": "-6496407278109851648"
    }
  ],
  "NextPageLink": null,
  "Count": 1
}

编辑

我的代码

   $getsbCurrencyDetailsclass = new myobsbfunctions($_SESSION['access_token'],api_key);
        $getsbCurrencyDetails = $getsbCurrencyDetailsclass->getResponsenew($cf_uri. "/GeneralLedger/Currency/?" .'$filter' ."=Code%20eq%20'{$docCurrencyType}'");

        
        $getsbCurrencyDetails = json_decode($getsbCurrencyDetails);

        $result=$getsbCurrencyDetails['Items'];
        //print("<pre>".print_r($result,true)."</pre>");
        echo $getsbCurrencyDetails
4

1 回答 1

1

您需要将 JSON 转换为数组,然后操作此数组。假设文本在$json

$array=json_decode($json, true);
$result=$array['Items'];

编辑

我忘了第二个参数json_decode

于 2020-10-02T08:43:11.187 回答