在php中获取图像src [英] getting image src in php
本文介绍了在php中获取图像src的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用php函数从img标签获取图像源。
how to get image source from an img tag using php function.
推荐答案
考虑采用看看这个。
我不确定这是否是可接受的方法解决您的问题,但请检查此代码段:
I'm not sure if this is an accepted method of solving your problem, but check this code snippet out:
// Create DOM from URL or file
$html = file_get_html('http://www.google.com/');
// Find all images
foreach($html->find('img') as $element)
echo $element->src . '<br>';
// Find all links
foreach($html->find('a') as $element)
echo $element->href . '<br>';
这篇关于在php中获取图像src的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文