1
$str = "html code here and img tag";
preg_match_all('~<img ([^>]+)>~i', $str, $matches);
$images = array();
foreach ($matches[1] as $str) {
preg_match_all('~([a-z]([a-z0-9]*)?)=("|\')(.*?)("|\')~is', $str, $pairs);
}
我無法從IMG獲取SRC,如何創意?如何從html圖像標記獲取src =「」
參見:http://stackoverflow.com/questions/1058852/regex-to-get-src-value-from-an-img-tag – Andy 2011-12-14 10:21:13