提问人:Igor Moskal 提问时间:7/25/2015 更新时间:11/16/2023 访问量:40
PHP 简单 HTML DOM
PHP Simple HTML DOM
问:
帮助解析 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', .....]
答:
0赞
Francesco de Guytenaere
7/25/2015
#1
根据您在评论中添加的图像,我想您会想要这样的东西:
<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>
评论