如何让flashHTML代码中的object替换成video标签

<?php
	
	$html='<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="quality" value="high" /><param name="movie" value="/user_guide/upload/video/1574925873.mp4" /><embed pluginspage="http://www.macromedia.com/go/getflashplayer" quality="high" src="/user_guide/upload/video/1574925873.mp4" type="application/x-shockwave-flash"></embed></object>
	<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540001" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="quality" value="high" /><param name="movie" value="/user_guide/upload/video/1574925873.mp4" /><embed pluginspage="http://www.macromedia.com/go/getflashplayer" quality="high" src="/user_guide/upload/video/1574925873.mp4" type="application/x-shockwave-flash"></embed></object>
	<img alt="" src="/user_guide/upload/img/1574925981.jpg" style="width: 240px; height: 180px;" /></p>';
	preg_match_all('/<object(.*?)>(.*?)<\/object>/s',$html,$match);
	$htm=$html;
	foreach($match[0] as $ma){
		preg_match('/<embed(.*?)src="(.*?)"(.*?)><\/embed>/s',$ma,$matsh);
		$video_src=$matsh[2];
		$htm=str_replace($ma,'<video src="'.$video_src.'" ></video>',$htm);
	}
	echo $htm;


?>

 

posted @ 2019-12-02 11:12  开源  阅读(322)  评论(0编辑  收藏  举报