Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html字符串拼接说明 #9

Open
chenxiaochun opened this issue Apr 26, 2017 · 0 comments
Open

html字符串拼接说明 #9

chenxiaochun opened this issue Apr 26, 2017 · 0 comments

Comments

@chenxiaochun
Copy link
Contributor

chenxiaochun commented Apr 26, 2017

注意:此说明仅适用于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同学的反馈。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant