douche1936 2010-12-12 08:54
浏览 50

删除对象标记但保留嵌入

I want have some videos like this:

<object style="display:block;margin-left:auto;margin-right:auto;" width="550" height="350" data="http://www.youtube.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.

  • 写回答

1条回答 默认 最新

  • dos8410 2010-12-12 09:02
    关注

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

    strip_tags($str,'<embed>');
    
    评论

报告相同问题?

悬赏问题

  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器