0
首先,我的PHP技能並不好。我想列出,看起來像這樣所有鏈接:PHP preg_match列表鏈接
<a href="..." class="bokstav">...</a>
從網站:
file_get_contents('.....');
我怎樣才能找到的preg_match或這樣這些鏈接?
/TB
首先,我的PHP技能並不好。我想列出,看起來像這樣所有鏈接:PHP preg_match列表鏈接
<a href="..." class="bokstav">...</a>
從網站:
file_get_contents('.....');
我怎樣才能找到的preg_match或這樣這些鏈接?
/TB
這是一個與phpQuery或QueryPath簡單:
$html = file_get_contents($url);
$qp = qp($html);
foreach ($qp->find("a.bokstav") as $a) {
print $a->attr("href");
}
如果你想用的preg_match來試試吧,看看http://www.regular-expressions.info/examples.html或https://stackoverflow.com/questions/89718/is-there-anything-like-regexbuddy-in-the-open-source-world上手。
改爲使用DomDocument(使用loadHTML()方法)。 – arnaud576875 2011-02-02 19:12:47