小编Oni*_*ion的帖子

使用php删除内联样式

我使用PHP输出一些富文本.如何完全去除内联样式?

文本将直接从MS Word或OpenOffice粘贴到使用TinyMCE的文本中,TinyMCE是一种富文本编辑器,允许您向文本添加基本HTML格式.但是我想删除内联样式

标签(见下文),但保留

标记自己.

<p style="margin-bottom: 0cm;">A patrol of Zograth apes came round the corner, causing Rosette to pull Rufus into a small alcove, where she pressed her body against his. &ldquo;Sorry.&rdquo; She said, breathing warm air onto the shy man's neck. Rufus trembled.</p>
<p style="margin-bottom: 0cm;">&nbsp;</p>
<p style="margin-bottom: 0cm;">Rosette checked the coast was clear and pulled Rufus out of their hidey hole. They watched as the Zograth walked down a corridor, almost out of sight and then collapsed …
Run Code Online (Sandbox Code Playgroud)

php styles inline

10
推荐指数
3
解决办法
2万
查看次数

验证字段的最佳正则表达式是什么?

我在用户输入的字段上使用正则表达式,以确保它们输入了1到20个字符.

这是代码:

$post_validations = array("title" => '/^[[:alnum:][:punct:][:space:]]{1,100}$/');
Run Code Online (Sandbox Code Playgroud)

但是每当用户输入外来字符或MS Word中的特殊引号字符时(我无法将其粘贴到此处,它将其转换为正常引用!)正则表达式不会返回true,并且它显示错误.

我想知道什么是最好的正则表达式使用?

谢谢

php regex user-generated-content

0
推荐指数
1
解决办法
86
查看次数

标签 统计

php ×2

inline ×1

regex ×1

styles ×1

user-generated-content ×1