📜  php 从图像标签中获取 src 内容 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:18.231000             🧑  作者: Mango

代码示例1
$html = 'Image';

$doc = new DOMDocument();
$doc->loadHTML($html);
$xpath = new DOMXPath($doc);
$src = $xpath->evaluate("string(//img/@src)"); # "/images/image.jpg"