Smarty - 使用 if isset() 时不会显示设置的变量
我得到以下代码:
{$productinfo.ProductPhone} {if isset($productinfo.Productphone)} {$business_business_phone} {$productinfo.ProductPhone} {/如果}
第一行用作见证并返回电话号码。 该值来自数据库,因此如果没有电话号码,我不希望出现随机的“phone:”(这是处理多种语言的 {$business_business_phone} 变量。
我的问题是... {$business_business_phone} { $productinfo.ProductPhone} 应该显示,因为有一个值。
I got the following code:
{$productinfo.ProductPhone}
{if isset($productinfo.Productphone)}
{$business_business_phone} {$productinfo.ProductPhone}
{/if}
The first line is used as a witness and does return the phone number.
This value comes from database, so if there's no phone number, I don't want a random "phone:" hanging around (that's the {$business_business_phone} variable to handle multiple languages.
My problem is... {$business_business_phone} {$productinfo.ProductPhone} should be displayed since there's a value.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我查了一下。确实是数据库层的问题。它插入一个空字符串。已经解决了:)
非常感谢
I checked. It was indeed a problem in the database layer. It inserts an empty string. It's fixed :)
Thanks a lot