1
是否可以從我回來的那個地方找到最大的圖像。從URL獲取最大的圖像via php
這裏是代碼我迄今爲止:
<?php
$url="https://wikipedia.org/wiki/PHP";
$html = file_get_contents($url);
$doc = new DOMDocument();
@$doc->loadHTML($html);
$tags = $doc->getElementsByTagName('img');
foreach ($tags as $tag) {
echo $tag ->getAttribute('src');
}
?>
例如圖1:420x120px;圖2:1200x300px - 從IMG>輸出鏈接URL 2
檢查['getimagesize'](http://php.net/manual/en/function.getimagesize.php#refsect1-function.getimagesize-examples) –