Parsing values from JSON using php

后端 未结 4 1480
再見小時候
再見小時候 2020-12-22 06:16

I\'m new to PHP and JSON, so hoping someone can help me.

I have a PHP which a 3rd party performs a POST against, delivering JSON data. An example of the data sent wo

4条回答
  •  时光取名叫无心
    2020-12-22 06:27

    First, I would suggest passing true as the second argument to json_decode. This results in an associative array rather than an object, which makes it a little easier to work with.

    Then, you can do this:

    $fee = $event_json['data']['object']['fee'];
    

    You can chain these square brackets as many times as needed to delve deeper into the array.

提交回复
热议问题