项目用到富文本编辑器,在提交到数据库时,原始的值是包含HTML编码的样式,但我们又不需要这些无用的样式,需要将其内容提取出来
未处理前,原始的值是这样的
<p><span style="color: rgb(25, 25, 25); font-family: "PingFang SC",
Arial, 微软雅黑, 宋体, simsun, sans-serif; font-size: 16px; font-style: normal;
font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; orphans: 2; text-align: justify; text-indent: 0px;
text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);
display: inline !important; float: none;">爱上一个人最明显的特征就是会习惯他的习惯,
即便哪天分开了,也还是在继续着他的习惯。分开后的第一、二个月之所以那么痛苦,也是因为习惯。
</span><strong style="font-weight: 700; border: 0px; margin: 0px; padding: 0px;
font-size