douxianji6104 2011-11-04 04:40
浏览 151
已采纳

将<p>更改为<br>

Is it possible to find all <p> tabs in a string and replace them with <br> tabs?

For example, if I have a string which looks like this:

<p>some test here</p>
<p>some more test here</p>
<p>some other test here</p>

Is it possible to change it to the following:

some test here<br /><br />
some more test here<br /><br />
some other test here<br /><br />
  • 写回答

3条回答 默认 最新

  • duanpuchen3142 2011-11-04 04:42
    关注

    In what language? PHP?

    $text=str_replace(array('<p>','</p>'),array('','<br /><br />'),$text);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部