Php-json multi-dimensional array processing, how to set the value. -Php Tutorial

Source: Internet
Author: User
Php-json multi-dimensional array processing, how to set the value. An ajax call gets a string of return values from Alibaba's big fish api. {"Alibaba_aliqin_fc_sms_num_send_response": {"result": {"err_code": "0", "model": "101119416903 ^ 1101601857156", "success": true }, "request_id": "1476c431qgbi4 "}}
I can use $ starr = json_decode ($ str, true); to get the $ starr array. But how do I obtain the success data in the array $ starr? I need success for further judgment. And. Is the returned value json data? If yes, I will upload it to the front-end using jquery ajax. How can we get the success value?


Reply to discussion (solution)

$str = '{"alibaba_aliqin_fc_sms_num_send_response":{"result":{"err_code":"0","model":"101119416903^1101601857156","success":true},"request_id":"1476c431qgbi4"}}';$starr= json_decode($str,true);echo $starr['alibaba_aliqin_fc_sms_num_send_response']['result']['success'];


Js:
Json. alibaba_aliqin_fc_sms_num_send_response.result.success
You can also write
Json ['alibabaca_aliqin_fc_sms_num_send_response'] ['result'] ['success']

Yes. Upstairs, I have successfully called it. $ Starr [0] [0] [1] and so on cannot be used.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.