HTML代碼與用戶定義的標籤使用preg_match_all圖像源
<img src="http://website/image/ngshjk.jpeg" onload="img_onload(this);" onerror="img_onerror(this);" data-pid="dynamicvalue" data-imagesize="ppew" data-error-url="http://img.comb/6/z2default.jpg" class="small_image imageZoom " alt="image" title="" id="visible-image-small" rel="dynamicvalue" data-zoom-src="http://img.comb/6/z21347.jpeg" style="display: inline;">
PHP代碼
preg_match_all('/<img(.*) onload="(.*)" \/s',$con,$val);
而在這頁有這麼多的img標籤。所以我試圖使用img標籤中的一些屬性來獲取特定圖像的src。我在preg_match_all中無法正確。請糾正我在獲取上述img標籤中的源代碼。
這個所需的圖像標記與所有其他圖像標記有何不同? –
@Denomales這就是爲什麼我無法做到。我敢肯定其他img標籤沒有onload =「img_onload(this);」 –
最好是在你的代碼中簡單地找到所有的圖像標籤作爲列表,然後在你的代碼中簡單地檢查它們以找到有趣的那些? –