Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php和wordpress等多种分类法_Php_Wordpress_Posts - Fatal编程技术网

php和wordpress等多种分类法

php和wordpress等多种分类法,php,wordpress,posts,Php,Wordpress,Posts,我有3种分类法,例如: Country City Person 所有分类法都是独立的,处于同一级别,我有4篇不同术语的帖子: Post 1 => Country: Italy Post 2 => City: Rome Post 3 => Person: Mario Rossi Post 4 => Italy, Rome and Mario Rossi Post 5 => No Taxonomies 现在,我需要得到一个返回,作为一个hirechial多维数组,如

我有3种分类法,例如:

Country
City
Person
所有分类法都是独立的,处于同一级别,我有4篇不同术语的帖子:

Post 1 => Country: Italy
Post 2 => City: Rome
Post 3 => Person: Mario Rossi
Post 4 => Italy, Rome and Mario Rossi
Post 5 => No Taxonomies
现在,我需要得到一个返回,作为一个hirechial多维数组,如下所示,从帖子开始:

Array(
      "Italy" => array(
            "Rome" => array(
                  "Mario Rossi" => array(
                        "Post 1" => array(.....),
                        "Post 2" => array(.....),
                        "Post 3" => array(.....),
                        "Post 4" => array(.....)
                  )
                  "No Person" => array(
                        "Post 1" => array(.....),
                        "Post 2" => array(.....),
                        "Post 4" => array(.....)
                  )
            ),
            "No City" => array(
                  "Mario Rossi" => array(
                        "Post 1" => array(.....),
                        "Post 3" => array(.....),
                        "Post 4" => array(.....),
                  ),
                  "No Person" => array(
                        "Post 1" => array(.....),
                        "Post 4" => array(.....)
                  )                  
            )
      )
      "No Nation" => array(
            "Rome" => array(
                  "Mario Rossi" => array(
                        "Post 2" => array(.....),
                        "Post 3" => array(.....),
                        "Post 4" => array(.....),
                  ),
                  "No Person" => array(
                        "Post 2" => array(.....),
                        "Post 4" => array(.....),
                  )
            ),
            "No City" => array(
                  "Mario Rossi" => array(
                        "Post 3" => array(.....),
                        "Post 4" => array(.....),
                  ),
            "No Person" => array(
                    "Post 5" => array(......)
                  )
            )
      )
);
我该怎么办

非常感谢你的帮助


祝您有愉快的一天。

为什么需要像这样将其作为数组返回?有些事情告诉我,你可以比这更容易地实现你想要的。另外,你需要一些“地图”或类似的东西来定义国家、城市和人之间的关系。看起来你需要一个foreach:嗨@cale_b,你能解释一下你说“地图”是什么意思吗?thx为什么需要像这样以数组的形式返回它?有些事情告诉我,你可以比这更容易地实现你想要的。另外,你需要一些“地图”或类似的东西来定义国家、城市和人之间的关系。看起来你需要一个foreach:嗨@cale_b,你能解释一下你说“地图”是什么意思吗?谢谢