html中显示优酷视频,html5

html中显示优酷视频,html5

巴扎黑2017-04-17 12:10:441楼

看到上面的答案,可能有人会有雾水。我来补充一下。

如果使用ueditor,kineditor等富文本编辑器插入的视频,其默认是插入swf结尾的url

这个时候,html5是不支持的。

那么如何做呢?

在解析html5模板的时候,取出视频url地址,替换为通用html代码。

function attach_youku($message){

$pattern = "/\[media\](.*?)\[\/media\]/ies";

if(strpos($message, '[/media]') !== FALSE) {

preg_match($pattern,$message,$matches,PREG_OFFSET_CAPTURE);

if($matches){

preg_match("/\/sid\/(.*)\/v.swf/i",$matches[0][0],$urlMatches);

if($urlMatches){

$embed = "";

$message = substr($message,0,$matches[0][1]) .$embed. substr($message,$matches[0][1]+strlen($matches[0][0]));

}

}

return attach_youku($message);

}else{

return $message;

}

}

发布者:admin,转转请注明出处:http://www.yc00.com/news/1704970204a1384788.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信