时间:2021-05-26
复制代码 代码如下:
<?php
$json='{
"rec_items": [
{
"classes": "玄幻",
"gid": 6326585,
"author": "我吃西红柿",
"nid": 10079306,
"last_sort": 841,
"last_chapter_name": "第二十五卷 第六章 一扫而空",
"sub_count": 5364424,
"novel_name": "莽荒纪",
"last_update_time": 1393679718826
},
{
"classes": "玄幻",
"gid": 6109786,
"author": "唐家三少",
"nid": 10079046,
"last_sort": 1153,
"last_chapter_name": "第三百八十一章 开始行动(中)",
"sub_count": 3933876,
"novel_name": "绝世唐门",
"last_update_time": 1393681654511
},
{
"classes": "玄幻",
"gid": 10645516,
"author": "辰东",
"nid": 12649548,
"last_sort": 478,
"last_chapter_name": "第四百三十二章 扛媳妇回村",
"sub_count": 1422482,
"novel_name": "完美世界",
"last_update_time": 1393681655610
},
{
"classes": "玄幻",
"gid": 4711723,
"author": "只是小虾米",
"nid": 12629406,
"last_sort": 2603,
"last_chapter_name": "第2588章 苏醒!",
"sub_count": 2841630,
"novel_name": "武逆",
"last_update_time": 1393605899300
},
{
"classes": "玄幻",
"gid": 3701669,
"author": "苍笑天",
"nid": 8583556,
"last_sort": 3427,
"last_chapter_name": "第两千两百二十五章 孔雀王!",
"sub_count": 606473,
"novel_name": "武破九霄",
"last_update_time": 1391279170831
},
{
"classes": "玄幻",
"gid": 8141499,
"author": "风凌天下",
"nid": 9212380,
"last_sort": 2579,
"last_chapter_name": "第五百二十六章 九劫、天帝之战【七】",
"sub_count": 3082857,
"novel_name": "傲世九重天",
"last_update_time": 1393677692614
}
],
"cate_book_items": [
{
"classes": "玄幻",
"gid": 4711723,
"author": "只是小虾米",
"nid": 12629406,
"last_sort": 2603,
"last_chapter_name": "第2588章 苏醒!",
"sub_count": 2841630,
"novel_name": "武逆",
"last_update_time": 1393605899300
},
{
"classes": "玄幻",
"gid": 3701669,
"author": "苍笑天",
"nid": 8583556,
"last_sort": 3427,
"last_chapter_name": "第两千两百二十五章 孔雀王!",
"sub_count": 606473,
"novel_name": "武破九霄",
"last_update_time": 1391279170831
},
{
"classes": "玄幻",
"gid": 10645516,
"author": "辰东",
"nid": 12649548,
"last_sort": 478,
"last_chapter_name": "第四百三十二章 扛媳妇回村",
"sub_count": 1422482,
"novel_name": "完美世界",
"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 '<pre>';
print_r($data);
echo '<br>';
print_r(mult_unique($data));
echo '</pre>';
?>
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
php去掉二维数组的重复值的方法总结,具体代码如下:方法一://二维数组去掉重复值functionarray_unique_fb($array2D){forea
本文实例讲述了php计算多维数组中所有值总和的方法。分享给大家供大家参考。具体实现方法如下:php内置函数array_sum()函数返回数组中所有值的总和,只能
本文实例讲述了php实现多维数组中每个单元值(数字)翻倍的方法。分享给大家供大家参考。具体分析如下:前提:一个多维数组,它的每个最小单元值都为数字。要求:写一个
php中去一维数组的重复项可以通过php内置函数array_unique(),但是php的array_unique函数对多维数组并不适用,怎么才能去除二维数组中
本文实例讲述了PHP实现多维数组转字符串和多维数组转一维数组的方法。分享给大家供大家参考。具体实现方法如下:/***@method多维数组转字符串*@param