帮助解析DOM树 正在关注树
<div itemprop="description" property="v:description">
<span class="gray">type:</span>
black
<br>
<span class="gray">type2:</span>
pack
<br>
</div>
&#13;
形式的档案
$data = ['type:' => 'black', .....]
答案 0 :(得分:0)
根据你在评论中添加的图片,我想你想要这样的东西:
<div itemprop="description" property="v:description">
<?php
$data = ['type' => 'black', 'type2' => 'pack'];
foreach ($data as $key => $value) {
?>
<span class="gray"><?php echo $key; ?>:</span>
<?php echo $value; ?>
<br />
<?php
}
?>
</div>
注意:关于你的要求有点不清楚:你可以在这里阅读更多相关信息:https://stackoverflow.com/help/how-to-ask