是否可以从discogs.com列表中获取专辑插图img src?

问题描述 投票:0回答:1

我正在尝试使用preg_match或preg_match_all来获取https://www.discogs.com/Lady-Gaga-Chromatica/release/15386439的封面作品>

到目前为止,我只能获得Discogs徽标和网站图标。

这是我使用的代码,它产生两个图像,Discoggs.com的徽标和收藏夹图标:

<?php
$text = file_get_contents("https://www.discogs.com/Lady-Gaga-Chromatica/release/15386439");
preg_match_all('/<img.*>/',$text,$out);
print_r($out);
?>
    

我正在尝试使用preg_match或preg_match_all从https://www.discogs.com/Lady-Gaga-Chromatica/release/15386439获取封面图稿,到目前为止,我只能获得Discogs徽标和...

php preg-match preg-match-all
1个回答
0
投票

[我在您的正则表达式模式中看到的一个潜在问题是贪婪点.*,它可能是跨非标签内容匹配标签。考虑使用.*?

© www.soinside.com 2019 - 2024. All rights reserved.