PHP 简单 HTML DOM

问题描述 投票:0回答:1

帮助解析 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',  .....]
html parsing dom
1个回答
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>
© www.soinside.com 2019 - 2024. All rights reserved.