>因为要对文章内容的图片进行提取,所有记录此代码。 ```php //提取图片 $html = ''; $doc = new DOMDocument(); $doc->loadHTML($html); $xpath = new DOMXPath($doc); $images = $xpath->evaluate("//img"); foreach ($images as $image) { $src = $image->getAttribute('src'); echo $src; echo "\n"; } ```