PHP 获取图像 src [英] PHP get image src

查看:42
本文介绍了PHP 获取图像 src的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$variable = '<img src="http://www.gravatar.com/avatar/66ce1f26a725b2e063d128457c20eda1?s=32&d=identicon&r=PG" height="32" width="32" alt=""/>';

如何获取这张图片的src?

喜欢:

$src = 'http://www.gravatar.com/avatar/66ce1f26a725b2e063d128457c20eda1?s=32&d=identicon&r=PG';

谢谢.

推荐答案

您可以为此使用 html 解析器.看到这个:http://simplehtmldom.sourceforge.net/(我希望这适用于节点,而不是仅适用于整个页面).

You can use an html parser for this. See this one: http://simplehtmldom.sourceforge.net/ (I hope this works for nodes, not just for entire pages).

这篇关于PHP 获取图像 src的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆