禁用智能通知
我想禁用 smarty-s 通知。
这正是:
注意:未定义的变量:xy
因为我知道有些变量是未定义的,在某些情况下我什至不想定义它们。
但我不想禁用其他 PHP 通知。
感谢您的帮助!
I would like to disable smarty-s notices.
This exactly:
Notice: Undefined variable: xy
Because I know that some variables are undefined and in some cases I don't even want to define them.
BUT I don't want to disable other PHP notices.
Thanks for help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您应该使用这个: http://www.smarty.net/docs/ en/variable.error.reporting.tpl
设置即可
You should use this: http://www.smarty.net/docs/en/variable.error.reporting.tpl
Just set
您应该检查变量并确保它们在使用前已定义和设置。删除通知和警告可以增强应用程序的性能。
当您的应用程序或网站发布时,您应该添加以下条件以避免向客户显示错误:
仅出现警告和错误。
You should make your checks on the variables and make sure they are defined and set before using. Removing the Notices and Warnings enhance the performance of your application.
When your application or website is published you should add the following condition to avoid errors from appearing to your customers:
Only warning and Errors will appear.
从 Smarty4 开始,有一种新方法:
参见 https://github .com/smarty-php/smarty/blob/v4.0.0/CHANGELOG.md
Since Smarty4 there is a new method:
See https://github.com/smarty-php/smarty/blob/v4.0.0/CHANGELOG.md