我在 php 中有一个数组,在执行 print_r($breadcrumb) 时看起来像这样
Array (
[url] => /category/
[text] => Category
)
Array (
[url] => /category/subcategory/
[text] => Subcategory
)
Array (
[url] => /category/subcategory/subsubcategory/
[text] => Subsubcategory
)
我希望这个面包屑显示为
Category > Subcategory > Subsubcategory
根据Google 文档,HTML 应如下所示:
<div xmlns:v="http://rdf.data-vocabulary.org/#">
<span typeof="v:Breadcrumb">
<a href="/category/" rel="v:url" property="v:title">
Category
</a> ›
<span rel="v:child">
<span typeof="v:Breadcrumb">
<a href="/category/subcategory/" rel="v:url" property="v:title">
Subcategory
</a> ›
<span rel="v:child">
<span typeof="v:Breadcrumb">
<a href="/category/subcategory/subsubcategory/" rel="v:url" property="v:title">
Subsubcategory
</a> ›
</span>
</span>
</span>
</span>
</span>
</div>
如何从 PHP 数组转到 HTML?
我看过其他答案,但它们在我的场景中不起作用