Home  >  Article  >  Backend Development  >  php中如何用preg_match_all匹配字符串

php中如何用preg_match_all匹配字符串

WBOY
WBOYOriginal
2016-06-02 11:32:391203browse

php

<code> <div class="Wrapper">
<div class="colImg"><a href="http://store.shopping.yahoo.co.jp/matsunami/fcdm3.html"></a></div>
<div class="wrCol cf">
<div class="colText"></div>
<div class="colPrice"><p class="price"><em>4,603</em></p></div>
<div class="colStore"></div>
</div>
<div class="itemMatch"><a href="http://topics.shopping.yahoo.co.jp/notice/archives/post_8.html">123</a></div>
</div></code>

我想要获取

<code> <div class="Wrapper"></div></code>

里面的整个内容(包含了6个div,也可能是7个div,所以包含的div个数可能不定),即:

<code><div class="colImg"><a href="http://store.shopping.yahoo.co.jp/matsunami/fcdm3.html"></a></div>
<div class="wrCol cf">
<div class="colText"></div>
<div class="colPrice"><p class="price"><em>4,603</em></p></div>
<div class="colStore"></div>
</div>
<div class="itemMatch"><a href="http://topics.shopping.yahoo.co.jp/notice/archives/post_8.html">123</a></div></code>

如何用preg_match_all获取如上字符串,或者用其他方法来实现?

Statement:
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