2012-05-15 53 views
0

我有這樣的代碼來獲取所有img標籤:如何阻止preg_match_all返回完整模式匹配數字?

<?php 

foreach($design_children as $design_child) { 
    echo preg_match_all('/<img[^>]+>/i', $design_child->post_content, $result); 
    echo $result[0]; 
    break; 
} 

?> 

,但我不斷收到圖案號返回我的輸出如2,3相匹配 旁邊,我的圖片 我怎麼刪除它??? !

+0

更改'echo preg_match_all(...);'只是'preg_match_all(...)'。然後檢查'$ result'是否被填充,如果不是爲了防止警告,請不要回顯。 – drew010

+0

ooops傻我..:謝謝很多人!它現在有效! –

+0

不客氣,馬上回來! – drew010

回答

0

preg_match_all之前刪除echo