问题
Here is the original code where I am extracted the data using Simple HTML Dom:
<div class="content-wrapper"><p><ac:image ac:height="250"><ri:attachment ri:filename="stories-img-05.png" /></ac:image></p></div>
Here is the code which i am using :
$html->find('div[class=content-wrapper] p ac:image ', 0)->innertext;
How can I get Image Path?
回答1:
For multiple use this code:
$img=array();
foreach($html->find('div.content-wrapper ri:attachment[ri:filename]') as $article) {
array_push($img, $article->attr['ri:filename']);
}
print_r($img);
For single use this:
$html->find('div.content-wrapper ri:attachment[ri:filename]')[0]->attr['ri:filename']
来源:https://stackoverflow.com/questions/44561418/how-can-i-extract-the-image-path-from-riattachment-rifilename-stories-img-05