我想獲取所有鏈接頁面類「page1」在php。 jQuery中在php中選擇標籤並獲取href
$("a#page1").echo(function()
{
});
相同的代碼可以做到這一點在PHP?
$pattern = '`.*?((http|ftp)://[\w#$&+,\/:;[email protected]%.-]+)[^\w#$&+,\/:;[email protected]%.-]*?`i';
preg_match_all($pattern,$page_g,$matches);
此代碼獲取$ page_g中的所有href,但它不適用於class =「page1」。 我只想在$ page_g中的所有href通過class =「page1」 可以幫助我優化請求ex或其他方式嗎? 例如
$page_g="<a href="/?s=cache:16001429:office+s01e02" title="" class="big">the <strong>office</strong> us s01 05 xvid mu</a> <a href="asd.com" class="a">asd</a>";
我想只返回/ S =緩存:16001429:辦公+ S01E02 TNX
,但我無法在搜索中打開它。任何人都能找到它?這是關於選擇所有''標籤與PHP – 2011-06-10 13:14:03
你的意思是'a.page1'而不是'#page1'? – 2011-06-10 13:46:56