如何从中获取价值......?

Moi*_*ohd 0 php arrays object

有人可以解释我如何从中获取数据...就像我只是想要主题,描述......等等...

stdClass Object
(
    [tickets] => Array
        (
            [0] => stdClass Object
                (
                    [url] => https://codemymobilecom.zendesk.com/api/v2/tickets/1.json
                    [id] => 1
                    [external_id] => 
                    [via] => stdClass Object
                        (
                            [channel] => sample_ticket
                            [source] => stdClass Object
                                (
                                    [from] => stdClass Object
                                        (
                                        )

                                    [to] => stdClass Object
                                        (
                                        )

                                    [rel] => 
                                )

                        )

                    [created_at] => 2015-04-22T08:30:29Z
                    [updated_at] => 2015-05-19T06:01:22Z
                    [type] => incident
                    [subject] => This is a sample ticket requested and submitted by you
                    [raw_subject] => This is a sample ticket requested and submitted by you
                    [description] => This is the first comment. Feel free to delete this sample ticket.
                    [priority] => high
                    [status] => closed
                    [recipient] => 
                    [requester_id] => 794599791
                    [submitter_id] => 794599791
                    [assignee_id] => 794599791
                    [organization_id] => 39742491
                    [group_id] => 24344491
                    [collaborator_ids] => Array
                        (
                        )

                    [forum_topic_id] => 
                    [problem_id] => 
                    [has_incidents] => 
                    [due_at] => 
                    [tags] => Array
                        (
                            [0] => sample
                            [1] => zendesk
                        )

                    [custom_fields] => Array
                        (
                        )

                    [satisfaction_rating] => 
                    [sharing_agreement_ids] => Array
                        (
                        )

                    [fields] => Array
                        (
                        )

                    [followup_ids] => Array
                        (
                        )

                    [brand_id] => 565681
                )

            [1] => stdClass Object
                (
                    [url] => https://codemymobilecom.zendesk.com/api/v2/tickets/10.json
                    [id] => 10 //multiple object like [0]...
Run Code Online (Sandbox Code Playgroud)

谢谢......任何帮助都会很棒..

pan*_*her 5

当您需要访问数组的密钥时,请使用[].当你有对象时,请使用->.

echo $obj->tickets[0]->subject; // returns first subject
echo $obj->tickets[0]->description; // returns first description
Run Code Online (Sandbox Code Playgroud)

你可以把它放到foreach循环中,当然是为了获得所有科目等.