帮助解析 DOM 树 正在跟随树
<div itemprop="description" property="v:description">
<span class="gray">type:</span>
black
<br>
<span class="gray">type2:</span>
pack
<br>
</div>
$data = ['type:' => 'black', .....]
根据您在评论中添加的图像,我想您会想要这样的东西:
<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>