[英]PHP syntax error - Can't figure it out
我已经看了一段时间了。 我如何修复语法?
echo("<a class=\"button\" href=\"viewcomment.php?id=".$id."> Comment(".$numberComments;.")</a>");
删除额外的semicolon
echo("<a class=\"button\" href=\"viewcomment.php?id=".$id."> Comment(".$numberComments.")</a>");
^ here
或直接,
echo("<a class=\"button\" href=\"viewcomment.php?id=$id> Comment($numberComments)</a>");
评论(”。$ numberComments; “)”)
那里有一个随机的分号:)
另外,当你不使用很多变量或者使用大量双引号时,我建议使用单引号(反之亦然)
像这样:
echo "<a href=\"asdf.php\">Wut</a>";
可以变成
echo '<a href="asdf.php">Wut</a>";
此外,由于回声是一种语言结构,而不是一种功能,PSR标准建议您不要将它括在括号中。
echo("this")
VS
echo "that"
没什么大不了的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.