Suitable for merging arrays to remove duplicate arrays. Mark for yourself, please. Www.appleshu.com
- $json = ' {
- "Rec_items": [
- {
- "Classes": "Fantasy",
- "GID": 6326585,
- "Author": "I eat tomatoes",
- "Nid": 10079306,
- "Last_sort": 841,
- "Last_chapter_name": "25th volume sixth chapter swept Away",
- "Sub_count": 5364424,
- "Novel_name": "Reckless and desolate",
- "Last_update_time": 1393679718826
- },
- {
- "Classes": "Fantasy",
- "GID": 6109786,
- "Author": "Tang Three Little",
- "Nid": 10079046,
- "Last_sort": 1153,
- "Last_chapter_name": "The No. 381 chapter begins to act (middle)",
- "Sub_count": 3933876,
- "Novel_name": "The Peerless Tang Gate",
- "Last_update_time": 1393681654511
- },
- {
- "Classes": "Fantasy",
- "GID": 10645516,
- "Author": "Chen Dong",
- "Nid": 12649548,
- "Last_sort": 478,
- "Last_chapter_name": "The No. 432 chapter carries the daughter-in-law back to the village",
- "Sub_count": 1422482,
- "Novel_name": "Perfect World",
- "Last_update_time": 1393681655610
- },
- {
- "Classes": "Fantasy",
- "GID": 4711723,
- "Author": "Just a little shrimp",
- "Nid": 12629406,
- "Last_sort": 2603,
- "Last_chapter_name": "The No. 2588 Chapter wakes up!" ",
- "Sub_count": 2841630,
- "Novel_name": "Wu Inverse",
- "Last_update_time": 1393605899300
- },
- {
- "Classes": "Fantasy",
- "GID": 3701669,
- "Author": "Pale Smile Day",
- "Nid": 8583556,
- "Last_sort": 3427,
- "Last_chapter_name": "Chapter 2,225 Peacock King!" ",
- "Sub_count": 606473,
- "Novel_name": "Wu broken Nine",
- "Last_update_time": 1391279170831
- },
- {
- "Classes": "Fantasy",
- "GID": 8141499,
- "Author": "Wind The World",
- "Nid": 9212380,
- "Last_sort": 2579,
- "Last_chapter_name": "The No. 526 Chapter nine robbery, the war of the Emperor" Seven ",
- "Sub_count": 3082857,
- "Novel_name": "Proud Kokonoe days",
- "Last_update_time": 1393677692614
- }
- ],
- "Cate_book_items": [
- {
- "Classes": "Fantasy",
- "GID": 4711723,
- "Author": "Just a little shrimp",
- "Nid": 12629406,
- "Last_sort": 2603,
- "Last_chapter_name": "The No. 2588 Chapter wakes up!" ",
- "Sub_count": 2841630,
- "Novel_name": "Wu Inverse",
- "Last_update_time": 1393605899300
- },
- {
- "Classes": "Fantasy",
- "GID": 3701669,
- "Author": "Pale Smile Day",
- "Nid": 8583556,
- "Last_sort": 3427,
- "Last_chapter_name": "Chapter 2,225 Peacock King!" ",
- "Sub_count": 606473,
- "Novel_name": "Wu broken Nine",
- "Last_update_time": 1391279170831
- },
- {
- "Classes": "Fantasy",
- "GID": 10645516,
- "Author": "Chen Dong",
- "Nid": 12649548,
- "Last_sort": 478,
- "Last_chapter_name": "The No. 432 chapter carries the daughter-in-law back to the village",
- "Sub_count": 1422482,
- "Novel_name": "Perfect World",
- "Last_update_time": 1393681655610
- }
- ]
- }';
- function Mult_unique ($array)
- {
- $return = Array ();
- foreach ($array as $key = $v)
- {
- if (!in_array ($v, $return))
- {
- $return [$key]= $v;
- }
- }
- return $return;
- }
- $json = Get_object_vars (Json_decode ($json));
- $data = $json [' Rec_items '];
- $data = Array_merge_recursive ($data, $json [' Cate_book_items ']);
- Echo '
'; - Print_r ($data);
- Echo '
'; - Print_r (Mult_unique ($data));
- Echo '
';
- ?>
Copy Code |