1. Put a???:
[{"0": "1011", "post_id": "1011", "1": "4", "Post_parent": "4", "2": "Hkbc_program_name_image", "Meta_key": "Hkbc_program _name_image "," 3 ":" "," Meta_value ":"},{"," 0 ":" 1011 "," post_id ":" 1011 "," 1 ":" 4 "," Post_parent ":" 4 "," 2 ":" Hkbc_ Program_name_special "," Meta_key ":" Hkbc_program_name_special "," 3 ":" 462 "," Meta_value ":" 462 "},{" 0 ":" 1011 "," post_ ID ":" 1011 "," 1 ":" 4 "," Post_parent ":" 4 "," 2 ":" Hkbc_program_ad "," Meta_key ":" Hkbc_program_ad "," 3 ":" 581 "," Meta_value " : "581"},{"0": "1011", "post_id": "1011", "1": "4", "Post_parent": "4", "2": "Hkbc_program_ad_url", "Meta_key": "Hkbc_ Program_ad_url "," 3 ":" http:\/\/music.baidu.com\/"," Meta_value ":" http:\/\/music.baidu.com\/"},{" 0 ":" 1011 "," post_ ID ":" 1011 "," 1 ":" 4 "," Post_parent ":" 4 "," 2 ":" Hkbc_program_sort "," Meta_key ":" Hkbc_program_sort "," 3 ":" 1.1 "," Meta_ Value ":" 1.1 "},1.1"},{"0": "1009", "post_id": "1009", "1": "117", "Post_parent": "117", "2": "Hkbc_program_name_image", " Meta_key ":" Hkbc_program_name_image "," 3 ":" 119 "," Meta_value ":" 119 "},{" 0 ":" 1009 "," post_id ":" 1009 "," 1 ":" 117 "," POST " _parent ":" 117 "," 2 ":"Hkbc_program_name_special "," Meta_key ":" Hkbc_program_name_special "," 3 ":" 463 "," Meta_value ":" 463 "},{" 0 ":" 1009 "," post_id ":" 1009 "," 1 ":" 117 "," Post_parent ":" 117 "," 2 ":" Hkbc_program_ad "," Meta_key ":" Hkbc_program_ad "," 3 ":" 111 "," Meta_value ":" 111 "},{" 0 ":" 1009 "," post_id ":" 1009 "," 1 ":" 117 "," Post_parent ":" 117 "," 2 ":" Hkbc_program_ad_url "," Meta_ Key ":" Hkbc_program_ad_url "," 3 ":" Http:\/\/baike.baidu.com\/view\/1433405.htm "," Meta_value ":" http:\/\/ Baike.baidu.com\/view\/1433405.htm "},{" 0 ":" 1009 "," post_id ":" 1009 "," 1 ":" 117 "," Post_parent ":" 117 "," 2 ":" Hkbc_ Program_sort "," Meta_key ":" Hkbc_program_sort "," 3 ":" 7 "," Meta_value ":" 7 "}]
???? Like:
[{"post_id": "1011", "Post_parent": "4", "Hkbc_program_name_image": "", "" hkbc_program_name_special ":" 462 "," hkbc_ " Program_ad ":" 581 "," Hkbc_program_ad_url ":" http:\/\/music.baidu.com\/"," Hkbc_program_sort ":" 1.1 "},{" post_id ":" 1009 "," Post_parent ":" 117 "," Hkbc_program_name_image ":" 119 "," hkbc_program_name_special ":" 463 "," Hkbc_program_ad ": "111", "Hkbc_program_ad_url": "Http:\/\/baike.baidu.com\/view\/1433405.htm", "Hkbc_program_sort": "7"}]
Reply to discussion (solution)
Dense, I don't want to see an example of a simple point
[{"0": "1011", "post_id": "1011", "1": "4", "Post_parent": "4", "2": "Hkbc_program_name_image", "Meta_key": "Hkbc_program _name_image "," 3 ":" "," Meta_value ":"},{"," 0 ":" 1011 "," post_id ":" 1011 "," 1 ":" 4 "," Post_parent ":" 4 "," 2 ":" Hkbc_ Program_name_special "," Meta_key ":" Hkbc_program_name_special "," 3 ":" 462 "," Meta_value ":" 462 "}]
Hopewell:
[{"post_id": "1011", "Post_parent": "4", "Hkbc_program_name_image": "", "" hkbc_program_name_special ":" 462 "}]
POST_ID is not only 1101, there are many
Read by JSON, merge then remove integer key?
?? , it's 1011.
?? The format is the above format,?? There is a lot of.
Read by JSON, merge then remove integer key?
A useful source of noodles?? ??? For the purpose of the project Of?
Where did you get this data from, did not find that the number key and character keys are generated two copies, if the number key is not necessary, you can generate only the associative array when generated.
Read by JSON, merge then remove integer key?
You?? The idea is positive,?? Have you solved the?,????.
/* # array filter* $array _param:array () */function myfilter ($array _param) {$temp = array (); $new _array = Array (); foreach ($array _param as $key = + $value) {if (Array_key_exists ($value ["post_id"], $temp)) {$temp [$value ["post_id"]] = Array_merge ($temp [$value ["post_id"]],array ($value ["Meta_key"]=> $value ["Meta_value"]);} else{$temp [$value ["post_id"]] = Array ("post_id" + $value ["post_id"], "post_parent" = = $value ["Post_parent"], $ value["Meta_key"]=> $value ["Meta_value"]);}} $new _array = array_values ($temp); return $new _array;}