disable smarty notice

杀马特。学长 韩版系。学妹 提交于 2019-12-04 21:34:01

问题


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!


回答1:


You should use this: http://www.smarty.net/docs/en/variable.error.reporting.tpl

Just set

$smarty->error_reporting = E_ALL & ~E_NOTICE;



回答2:


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:

error_reporting(E_ERROR || E_WARNING);

Only warning and Errors will appear.



来源:https://stackoverflow.com/questions/6789102/disable-smarty-notice

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!