【发布时间】:2017-09-19 17:18:21
【问题描述】:
我知道在 Stack Overflow 上已经多次询问过类似的问题,但我在 html/php 中遇到了三重嵌套引号问题。我查看了许多问题,但我找到的解决方案都没有为我工作。这是我正在尝试做的事情(可以在 php 文件中找到):
echo"<div id = 'feed-element'>
<button class='username-button' type='button'>@".$currentUsername."</button>
<button class='hashtag-one-button' type='button'>".$hashtag_one."</button>
<button class='hashtag-two-button' type='button'>".$hashtag_two."</button>
<button class='play-button' id='play-button".$i."' type='button' onclick='changeImage(this.id,\'".$track_url."\')'></button>
<button class='email-button' type='button'>Contact: ".$email."</button>
</div>";
导致我出现问题的具体行是倒数第三行:
<button class='play-button' id='play-button".$i."' type='button' onclick='changeImage(this.id,\'".$track_url."\')'></button>
无论如何,当我运行此代码时,我会收到 Uncaught Syntax: invalid or unexpected token 错误。我做错了什么?
【问题讨论】:
-
在引号前使用反斜杠。例如,“你的文字”
标签: javascript php html nested quotes