聪明的 if 语句帮助
我尝试了这段代码:
{if $login_status eq '1' }
<a href="{$html_header.base_url}login.php?logout " >Logout </a>
{/if}
并传递了值 {$login_status=1}。
这会导致:
Uncaught exception 'SmartyCompilerException' with message
'Syntax Error in template "tmpl\admin_login.tpl" on line 2 "{if $login_status eq '1' }" - Unexpected " }"' in C:\wamp
哪个不起作用。我做错了什么?
I tried this code:
{if $login_status eq '1' }
<a href="{$html_header.base_url}login.php?logout " >Logout </a>
{/if}
and passed the value {$login_status=1}.
This causes:
Uncaught exception 'SmartyCompilerException' with message
'Syntax Error in template "tmpl\admin_login.tpl" on line 2 "{if $login_status eq '1' }" - Unexpected " }"' in C:\wamp
Which is not working. What am I doing wrong ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
应该没有什么区别,但是您尝试过以下这些吗?您所包含的内容看起来是正确的。
我假设
{html_header.base_url}
是您的自定义函数。我只是想通过用静态的东西替换它来消除它是否引起任何问题,直到解决{if}
问题。There shouldn't be a difference, but have you tried any of these below? What you have included looks correct.
I'm assuming that
{html_header.base_url}
is a custom function of yours. I would just want to eliminate the question if it's causing any problems by replacing it with something static until you solve the{if}
issue.我认为这是因为结束括号之前的空格。
I think it's because of the space before the ending bracket.