Remove object tag but leave embed
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>');
精彩评论