Php-traverse json data and group the same data?

Source: Internet
Author: User
& Quot; {& quot; module_list & quot;: [{& quot; content & quot;: {& quot; module-type & quot;: & quot; list-1 & quot;, & quot; module & quot;: & quot; list & quot;, & quot; type & quot;: & quot; 1 & quot ;, & quot; name & quot;: & quot; job list & quot;, & quot; logo1 & quot;: & quot; imgurl1 & quot; traverse phpjson

{"Module_list": [{"content": {"module-type": "list-1", "module": "list", "type": "1 ", "name": "Job list", "logo1": "imgurl1", "title1": "baidu1", "desc1": "hahahha1", "url1": "www. baidu. com1 "," logo2 ":" imgurl2 "," title2 ":" baidu2 "," desc2 ":" hahahha2 "," url2 ":" www. baidu. com2 "," logo3 ":" imgurl3 "," title3 ":" baidu3 "," desc3 ":" hahahha3 "," url3 ":" www. baidu. com3 "," logo4 ":" "," title4 ":" "," desc4 ":" "," url4 ":" "," jobs ": [{"name": "product manager", "salary": "10 k-15 k", "url": "www.baidu.com", "desc": "Guangzhou ", "mark": "group: 1" },{ "name": "product manager", "salary": "10 k-15 k", "url ": "www.baidu.com", "desc": "Guangzhou", "mark": "group: 2" },{ "name": "product manager", "salary ": "10 k-15 k", "url": "www.baidu.com", "desc": "Guangzhou", "mark": "group: 3" },{ "name ": "Product Manager", "salary": "10 k-15 k", "url": "www.baidu.com", "desc": "Guangzhou", "mark": "group: 4 "},{" name ":" product manager "," salary ":" 10 k-15 k "," url ":" www.baidu.com "," desc ": "Guangzhou", "mark": "group: 1" },{ "name": "product manager", "salary": "10 k-15 k ", "url": "www.baidu.com", "desc": "Guangzhou", "mark": "group: 1" },{ "name": "product manager ", "salary": "10 k-15 k", "url": "www.baidu.com", "desc": "Guangzhou", "mark": "group: 4 "}, {"name": "product manager", "salary": "10 k-15 k", "url": "www.baidu.com", "desc": "Guangzhou ", "mark": "group: 4" },{ "name": "product manager", "salary": "10 k-15 k", "url ": "www.baidu.com", "desc": "Guangzhou", "mark": "group: 3" },{ "name": "product manager", "salary ": "10 k-15 k", "url": "www.baidu.com", "desc": "Guangzhou", "mark": "group: 2" },{ "name ": "Product Manager", "salary": "10 k-15 k", "url": "www.baidu.com", "desc": "Guangzhou", "mark": "group: 2 "}]},}]}
     public static function buildList($module){        $jobList2 = "";        if($module['jobs']){            foreach($module['jobs'] as $job){                $jobList2 .= <<                    {$job['name']}                    {$job['salary']}                html;            }        }                return<<

Yes. I concatenate pages using php statements, but when I obtain data from json, all the data is written as above, however, I want to display some specific data according to the mark value output, for example, only splicing group: 1 data. I am still not quite clear about the specific operations.

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.