0

我需要从 IMDB form image alt 获取电影评分表

<img width="44" height="15" title="PG_13" class="absmiddle" src="http://i.media-imdb.com/images/SF9c87441dc1ac3081c7de5a78d8864764/certificates/us/pg_13.png" **alt="PG_13"**>

我的代码(错误):

$arr['rate'] = $this->match('/<img class=\"absmiddle\" src=\"\(.*?)\" alt=\"\(.*?)">/ms', $html, 1);
4

1 回答 1

0
$text = '<img width="44" height="15" title="PG_13" class="absmiddle" src="http://i.media-imdb.com/images/SF9c87441dc1ac3081c7de5a78d8864764/certificates/us/pg_13.png" alt="PG_13">';
preg_match('<img[^<]+class="absmiddle" src="([^"]+)" alt="([^"]+)"/i', $text, $a);
$src = $a[1];
$alt = $a[2];
于 2012-04-28T16:56:31.263 回答