Home > Backend Development > PHP Tutorial > 求教,php写正则婚配html代码的数据

求教,php写正则婚配html代码的数据

WBOY
Release: 2016-06-13 12:45:07
Original
750 people have browsed it

求教,php写正则匹配html代码的数据
我想要获得 【学生图书】 的名字,图书的href URL地址,图书的图片地址,销售量,售价,市场价,怎么写正则匹配呢,我写的正则老是出问题?匹配不到数据

html代码

<div>
<br>
<div><a>学生图书一xxxx</a></div>
<br>
<table>
<br>
<tr>
<br>
<td>
<br>
<a><br>
<img  alt=" 求教,php写正则婚配html代码的数据 " ><br>
</a>
</td>
<br>
<td>
<br>
<p><br>
售出:336笔<br><br>
<span>¥139.00</span><br><br>
<del>¥239.00</del><br>
<br>
                    </p>
<br>
</td>
<br>
</tr>
<br>
</table>
<br>
<!--    139.00  --><br>
</div><br>
<br>
<hr><br>
   <br>
<!--catid=50010850, catPath= --><br>
                    <div>
<br>
<div>
<br>
<div><a>学生图书二</a></div>
<br>
<table>
<br>
<tr>
<br>
<td>
<br>
<a><br>
<img  alt=" 求教,php写正则婚配html代码的数据 " ><br>
</a>
</td>
<br>
<td>
<br>
<p><br>
售出:266笔<br><br>
<span>¥189.03</span><br><br>
<del>¥339.00</del><br>
<br>
                    </p>
<br>
</td>
<br>
</tr>
<br>
</table>
<br>
<!--    189.03  --><br>
</div>
<br>
</div><br>
<hr><br>
   <br>
<!--catid=50010850, catPath= --><br>
                    <div>
<br>
<div>
<br>
<div><a>学生图书三</a></div>
<br>
<table>
<br>
<tr>
<br>
<td>
<br>
<a><br>
<img  alt=" 求教,php写正则婚配html代码的数据 " ><br>
</a>
</td>
<br>
<td>
<br>
<p><br>
售出:120笔<br><br>
<span>¥239.04</span><br><br>
<del>¥398.00</del><br>
<br>
                    </p> <div class="clear">
                 
              
              
        
            </div>
</td>
</tr>
</table>
</div>
</div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template