Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
编辑器输出的内容带有html标签,
但我想将它们存储到 中Mongodb,所以我想我需要做一个逃生角色的工作,
Mongodb
ckeditor自己的转义字符方法吗?
顺便说一句,有必要做转义字符工作吗?或者我最好将它们转换为其他数据格式?
原生 JS 方法将解决您的问题:
escape( '<a href="#">Foo</a>' ) > %3Ca%20href%3D%22%23%22%3EFoo%3C/a%3E unescape( '%3Ca%20href%3D%22%23%22%3EFoo%3C/a%3E' ) > <a href="#">Foo</a>