您好,我想使用 preg_match 我有,为什么不工作?
$source = "<span class=\"middle\">".
"<span class=\"play\"></span>".
"<img width=\"114\" src=\"http://i.ytimg.com/vi/PnmEKNi1DtY/default.jpg\" alt=\"\"></span> 1";
preg_match("'<span class=\"middle\"><span class=\"play\"></span> <img width=\"114\" src=\"http://i.ytimg.com/vi/(.*?)/default.jpg\" alt=\"\"></span> 1'si", $source, $match);
foreach($match[1] as $val)
{
echo $val."<br>";
}
输出:
Warning: Invalid argument supplied for foreach()