How does php cyclically read the data?

Source: Internet
Author: User
How does php cyclically read the data? Body: [& nbsp; {bucket_name: wulinag09, status: 0, cdatetime: 1385619473, used_capacity: 0, total_capacity: 0, region: beijing}, & nbsp; & nb php how to read the data cyclically?
Body :[
{"Bucket_name": "wulinag09", "status": "0", "cdatetime": "1385619473", "used_capacity": "0", "total_capacity ": "0", "region": "beijing "},
{"Bucket_name": "wulinag08", "status": "0", "cdatetime": "1385619360", "used_capacity": "0", "total_capacity ": "0", "region": "beijing "},
{"Bucket_name": "wulinag07", "status": "0", "cdatetime": "1385619169", "used_capacity": "0", "total_capacity ": "0", "region": "beijing "},
{"Bucket_name": "wulinag06", "status": "0", "cdatetime": "1385618406", "used_capacity": "0", "total_capacity ": "0", "region": "beijing "},
{"Bucket_name": "wulinag05", "status": "0", "cdatetime": "1385618247", "used_capacity": "0", "total_capacity ": "0", "region": "beijing "},
{"Bucket_name": "wulinag04", "status": "0", "cdatetime": "1385618074", "used_capacity": "0", "total_capacity ": "0", "region": "beijing "},
{"Bucket_name": "wulinag03", "status": "0", "cdatetime": "1385435678", "used_capacity": "0", "total_capacity ": "0", "region": "beijing "},
{"Bucket_name": "wulinag02", "status": "0", "cdatetime": "1385435395", "used_capacity": "0", "total_capacity ": "0", "region": "beijing "}
]


I don't know the form of this data. There are eight rows of data in how to list the data in each row. I want to output eight rows in the form of a front-end table, and then read the data in each row using variables, such:
$ Rs [bucket_name] can get wulinag09
$ Rs [status] returns 0
$ Rs [cdatetime] can get 1385619473

Example push

Share:


------ Solution --------------------
The json data format indicates that the value of the body is the whole content. the complete code is as follows:

$body = '[
{"bucket_name":"wulinag09","status":"0","cdatetime":"1385619473","used_capacity":"0","total_capacity":"0","region":"beijing"},
{"bucket_name":"wulinag08","status":"0","cdatetime":"1385619360","used_capacity":"0","total_capacity":"0","region":"beijing"},
{"bucket_name":"wulinag07","status":"0","cdatetime":"1385619169","used_capacity":"0","total_capacity":"0","region":"beijing"},
{"bucket_name":"wulinag06","status":"0","cdatetime":"1385618406","used_capacity":"0","total_capacity":"0","region":"beijing"},
{"bucket_name":"wulinag05","status":"0","cdatetime":"1385618247","used_capacity":"0","total_capacity":"0","region":"beijing"},
{"bucket_name":"wulinag04","status":"0","cdatetime":"1385618074","used_capacity":"0","total_capacity":"0","region":"beijing"},
{"bucket_name":"wulinag03","status":"0","cdatetime":"1385435678","used_capacity":"0","total_capacity":"0","region":"beijing"},
{"bucket_name":"wulinag02","status":"0","cdatetime":"1385435395","used_capacity":"0","total_capacity":"0","region":"beijing"}
]';
$arrbody = json_decode($body);
?>



















foreach($arrbody as $key=>$value){?> foreach($value as $k=>$var){echo " ";}?> }?>
bucket_name status cdatetime used_capacity total_capacity region
$var

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.