如果字体家族有双引号,将HTML代码保存到数据库中?
我做了一个简单的文本编辑器。使用 javascript 选择选项,我将 font-family 添加到 innline-style 并更改 font-family 样式。之后我需要将 html 保存在 mysql 数据库中。
如果font-family没有像Arial那样有重复的引号,那么html会正常保存在数据库中,但是如果有重复的引号,在数据库中不会保存到最后,html会保存到font-family中:
我注意到 font-family: & 中的引号”泰晤士新罗马字体quot ;;
如果字体系列有双引号,如何将 html 代码保存到数据库?
保存到数据库后,如果没有重复引号:
<div id="child" class="child" style="width: 100px; height: 50px; color: rgb(0, 0, 0); font-family: Arial; font-size: 16px;"></div>
保存到数据库后,如果有双引号( font-family:"Times New Roman"; ):
<div id="child" class="child" style="width: 100px; height: 50px; color: rgb(0, 0, 0); font-family:
I do a simple text editor. With the javascript select option I add font-family to innline-style and change the font-family style. After that I need to ajax-save the html in the mysql database.
If font-family doesn't have duplicate quotes like Arial, then html is saved in the database normally, but if it has duplicate quotes, in the database it is not saved to the end, the html is saved to the font-family:
I noticed quotes in the font-family: & quot; Times New Roman & quot ;;
How do I enable saving html code to a database if the font family has double quotes?
After saving to the database if there are no duplicate quotes:
<div id="child" class="child" style="width: 100px; height: 50px; color: rgb(0, 0, 0); font-family: Arial; font-size: 16px;"></div>
After saving to the database if it has double quotes ( font-family:"Times New Roman"; ):
<div id="child" class="child" style="width: 100px; height: 50px; color: rgb(0, 0, 0); font-family:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
HTML 中常用的实体是双引号:
HTML 字符实体必须在 ajax 之前替换。
解决方案..,简单& ” 替换;
.replace("& quot","");
A commonly used entity in HTML is the double quotation mark:
HTML Character Entities must replace before ajax.
Solution.., simple & quot replace;
.replace("& quot","");