我有這個現有的代碼不起作用,因爲我想獲取flashvars,itemId值是爲了某種目的而採取的。我如何解析並採取它?如何解析嵌入對象並從此使用PHP獲取flashvars值?
我需要的值爲itemid = 「OWYrYlg5VW9GZUI4UjVnMXFOUGsrQT09」
<?php
$result = '<embed src=\'http://www.test.com//test_1.swf\' quality="high" FlashVars="itemId=OWYrYlg5VW9GZUI4UjVnMXFOUGsrQT09&autoplay=0&duration=02:45&url=http://test.com" bgcolor="#ffffff" wmode="opaque" width="320" height="65" name="player" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>';
//preg_match("/\<embed.*itemId\=\"(.+)\".*\>.*\<\/embed\>/Us",$result,$match);
parse_str($result, $output);
print '<pre>';
print_r ($output);
?>
可能重複的具體實施方法,以解析HTML(http://stackoverflow.com/questions/3577641/best- methods-to-parse-html) – 2011-04-28 09:29:03