Unrecognized Character Between Empty P Tags TinyMCE

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 09:26:42

问题


What character does tinyMCE put in between empty p tags.

I have the following empty p tags:

<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>

Which I'd like to remove... but they are not recognized by str_replace or preg_replace. The best I could do to track down the issue, is the space between the tags. In other words I can remove the

<p> 

by itself or the

</p>

... but when I try searching for

<p> </p> 

it doesn't find it.

Tried

&nbsp; 

or

&#32;

I found many solutions online but NONE work. It seems the character in question (the space between the p tags) is different or somehow not recognized. I say this because I tried the following

str_replace(" ", "", $html);

All of the other spaces in the string got deleted... EXCEPT for the space between the p tags.


回答1:


It is probably some non-printing unicode character of some type. \s or maybe \pS.

preg_replace("@<p>[\pZ\pC]*</p>@u", "", $string);


来源:https://stackoverflow.com/questions/22869608/unrecognized-character-between-empty-p-tags-tinymce

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!