2017-06-15 50 views

回答

0

對於多次使用此代碼:

$img=array(); 
    foreach($html->find('div.content-wrapper ri:attachment[ri:filename]') as $article) { 
     array_push($img, $article->attr['ri:filename']); 
    } 
    print_r($img); 

一次性使用這樣的:

$html->find('div.content-wrapper ri:attachment[ri:filename]')[0]->attr['ri:filename'] 
+0

這是JS,分享它的更多細節。 –

+0

我需要PHP的解決方案 –

+1

@NigSysTechnologies $ re ='/ri:filename="(.*)".*\/>/'; \t \t $ str ='

'; \t \t preg_match_all($ re,$ str,$ matches,PREG_SET_ORDER,0); \t \t echo $ matches [0] [1]; –

相關問題