jdf icon indicating copy to clipboard operation
jdf copied to clipboard

html字符串拼接说明

Open chenxiaochun opened this issue 8 years ago • 0 comments

注意:此说明仅适用于htmltplvmsmarty文件中的字符串拼接情况,并不适用于js文件中的字符串拼接

在html文件中拼接字符串时推荐使用以下格式,否则会产生输出html格式错乱的问题。

<h1 data-title="<p class='title'>多快好省</p>">京东商城</h1>

不推荐使用以下任何一种格式:

<h1 data-title='<p class="title">多快好省</p>'>京东商城</h1>
<h1 data-title="<p class=\"title\">多快好省</p>">京东商城</h1>

你问我它们之间有什么区别?其实就是单双引号位置的区别。双引号放在字符串最外层,里面如果需要引号请使用单引号。 问题原因是由于cheerio的处理机制引起的,具体解决方案正在排查。感谢loveky同学的反馈。

chenxiaochun avatar Apr 26 '17 01:04 chenxiaochun