开发者

Remove object tag but leave embed

开发者 https://www.devze.com 2023-01-29 22:47 出处:网络
I want have some videos like this: <object style=\"display:block;margin-left:auto;margin-right:auto;\" width=\"550\" height=\"350\" data=\"http://www.you开发者_运维知识库tube.com/v/DlK5N-Lcvjc\" t

I want have some videos like this:

<object style="display:block;margin-left:auto;margin-right:auto;" width="550" height="350" data="http://www.you开发者_运维知识库tube.com/v/DlK5N-Lcvjc" type="application/x-shockwave-flash"><param name="allowScriptAccess" value="never" /><param name="allowNetworking" value="internal" />

And I want to remove everything except <embed> tag. Also around the video there is more content which I want to keep.

I was trying to make this with preg_replace but it didn`t work.


Use strip_tags(), it accepts as optional parameter an array with tags that should not be removed.

strip_tags($str,'<embed>');
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号