php-遍曆json資料,對相同資料進行分組?

來源:互聯網
上載者:User
關鍵字 遍曆 php json
遍曆phpjson

 {    "module_list": [        {            "content": {                "module-type": "list-1",                "module": "list",                "type": "1",                "name": "職位列表 ",                "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": "產品經理",                        "salary": "10k-15k",                        "url": "www.baidu.com",                        "desc": "廣州",                        "mark": "group:1"                    },                    {                        "name": "產品經理",                        "salary": "10k-15k",                        "url": "www.baidu.com",                        "desc": "廣州",                        "mark": "group:2"                    },                    {                        "name": "產品經理",                        "salary": "10k-15k",                        "url": "www.baidu.com",                        "desc": "廣州",                        "mark": "group:3"                    },                    {                        "name": "產品經理",                        "salary": "10k-15k",                        "url": "www.baidu.com",                        "desc": "廣州",                        "mark": "group:4"                    },                    {                        "name": "產品經理",                        "salary": "10k-15k",                        "url": "www.baidu.com",                        "desc": "廣州",                        "mark": "group:1"                    },                    {                        "name": "產品經理",                        "salary": "10k-15k",                        "url": "www.baidu.com",                        "desc": "廣州",                        "mark": "group:1"                    },                    {                        "name": "產品經理",                        "salary": "10k-15k",                        "url": "www.baidu.com",                        "desc": "廣州",                        "mark": "group:4"                    },                    {                        "name": "產品經理",                        "salary": "10k-15k",                        "url": "www.baidu.com",                        "desc": "廣州",                        "mark": "group:4"                    },                    {                        "name": "產品經理",                        "salary": "10k-15k",                        "url": "www.baidu.com",                        "desc": "廣州",                        "mark": "group:3"                    },                    {                        "name": "產品經理",                        "salary": "10k-15k",                        "url": "www.baidu.com",                        "desc": "廣州",                        "mark": "group:2"                    },                    {                        "name": "產品經理",                        "salary": "10k-15k",                        "url": "www.baidu.com",                        "desc": "廣州",                        "mark": "group:2"                    }                ]            },        }    ]}
     public static function buildList($module){        $jobList2 = "";        if($module['jobs']){            foreach($module['jobs'] as $job){                $jobList2 .= <<                    {$job['name']}                    {$job['salary']}                html;            }        }                return<<

是這樣的,我通過php語句對頁面進行拼接,但從json擷取資料的時候,按上面寫拼出來的是全部 的資料,但是我想根據mark值輸出顯示一些特定的資料,比如只拼接group:1的資料,具體的操作我還是有些不太清楚

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    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.