我有一系列这样的数据
array(3) { [0]=> array(5) { ["cate_title"]=> string(30) "Printer Line - Round With Date" ["attr_id"]=> string(2) "15" ["attr"]=> string(6) "asdasd" ["option"]=> string(6) "asdasd" ["data_name"]=> array(0) { } } [1]=> array(5) { ["cate_title"]=> string(1) "w" ["attr_id"]=> string(2) "14" ["attr"]=> string(4) "asda" ["option"]=> string(5) "sdasd" ["data_name"]=> array(0) { } } [2]=> array(5) { ["cate_title"]=> string(1) "w" ["attr_id"]=> string(2) "13" ["attr"]=> string(3) "aaa" ["option"]=> string(8) "checkbox" ["data_name"]=> array(1) { [0]=> string(3) "bbb" } } }
我想将具有相同cate_title = w
的2个元素组合成1个数组,如此
<pre>
array(3) {
[0]=>
array(5) {
["cate_title"]=>
string(30) "Printer Line - Round With Date"
["attr_id"]=>
string(2) "15"
["attr"]=>
string(6) "asdasd"
["option"]=>
string(6) "asdasd"
["data_name"]=>
array(0) {
}
}
[1]=>
array(2) {
["cate_title"]=>string(1) "w"
["data-child"]=>array(2){
[0]=>array {
["attr_id"]=>string(2) "14"
["attr"]=>string(4) "asda"
["option"]=>string(5) "sdasd"
["data_name"]=> array(0) { }
}
[1]=>array {
["attr_id"]=>string(2) "13"
["attr"]=>string(4) "aaa"
["option"]=>string(5) "checkbox"
["data_name"]=> array(1) {
[0]=>
string(3) "bbb"
}
}
}
}
</pre>
请帮助我,我到处搜索但仍然没有答案
答案 0 :(得分:0)
这是解决方案
if(getIntent().hasExtra("jsondata")){
String hasValue = getIntent().getStringExtra("jsondata");
}