我有一个XML,我将其解析为PHP数组。它看起来像这样:
Array ( [Album] => Array ( [id] => 12 [name] => My album [id_parent] => 0 [row] => Array ( [Album] => Array ( [row] => Array ( [id] => 14 [name] => Another album [id_parent] => 12 [Photos] => Array ( [row] => Array ( [0] => Array ( [id] => 1078 [name] => My first photo [Album] => Array ( [row] => Array ( [name] =>Another album [id] => 15 [Photos] => Array ( [row] => Array ( [0] => Array ( [id] => 1069 [name] => Summer photo [checked] => [checked] )
等等。 如何将其解析为HTML列表(在嵌套的ul中),以获得类似
的内容My album -Another album --My first photo ---Another album ----Summer photo ---[end Another album] --[end My first photo] -[end Another album] [end My album]
专辑和照片只是样本。我需要找到一种如何将其解析为HTML的方法。
编辑: 好的,我添加了一些我真正想要的东西 - “已检查”节点。我只需要将父节点放入 标签。