douxingmou4533 2016-10-27 10:50
浏览 39

PHP strip_tags在ckeditor文本区域中删除新行。 怎么阻止它?

I'm using below line to remove text formatting from ckeditor result text area for some reasons.

html_entity_decode(strip_tags($result_string_from_ckeditor),ENT_QUOTES,'utf8');

It works great except than it stripping new lines and all separate lines will be join to each other.

I tried solution in this post and used below line, but no success

html_entity_decode(strip_tags(nl2br($result_string_from_ckeditor),'<br>'),ENT_QUOTES,'utf8');

Edit: for example

ckeditor source text:

<p>This is an example</p>

<p>of problem in strip_tags</p>

Source result after using command:

<p>This is an exampleof problem in strip_tags</p>

Many thanks.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?
    • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
    • ¥15 cmd cl 0x000007b
    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line