繁体   English   中英

如何从中提取图像路径<ri:attachment ri:filename=“stories-img-05.png” />

[英]How Can I extract the image path from <ri:attachment ri:filename=“stories-img-05.png” />

这是我使用简单HTML Dom提取数据的原始代码:

<div class="content-wrapper"><p><ac:image ac:height="250"><ri:attachment ri:filename="stories-img-05.png" /></ac:image></p></div>

这是我正在使用的代码:

$html->find('div[class=content-wrapper] p ac:image ', 0)->innertext;

我如何获得图像路径?

多次使用此代码:

    $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']

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM