聪明人期待“}”

Smarty expected "}"

我正在为网站使用 smarty 和 php,但我不知道为什么会出现此错误:

Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "C:\wamp\www\radacina\template\index\index.tpl" on line 23 "$(['images/bg-red.jpg','images/bg-orange.jpg','images/bg-green.jpg']).bgSlider({bgstretch:false,current:0,pags:'.pagination li a'})" - Unexpected ":", expected one of: "}" , " " , ATTR' in C:\wamp\www\radacina\include\smarty\sysplugins\smarty_internal_templatecompilerbase.php on line 656

第 23 行正是错误中描述的行,以防您可能会问。

Smarty 认为给定的行是一个 smarty 模板表达式,但它看起来有些像 javascript。 您应该在该行之前添加一个 {literal},并在该行之后添加一个 {/literal} 以让 smarty 知道不应解析该行。

(或者您可以使用较新的 smarty 版本或覆盖默认分隔符。)

以及相关文档:http://www.smarty.net/docsv2/en/language.function.literal