CakePhp:不显示一个警告
我的代码中有一个地方释放了一些 ingres 资源,但我无法知道该参数是否是有效的 ingres 资源。
所以我无论如何都想这样做(除非 ifempty() )。
我正在尝试捕获它,但是当这不是有效的资源时,我得到了 cakePhp 捕获的异常,然后它显示调试消息,并且它扰乱了整个站点的编码。
我知道我无法停用整个网站的调试,但该网站正在开发中,这不是我想要的。
那么,如何管理 cakePhp 使其不在此行上显示此异常的警告(我也不想忽略此类类型的所有错误)。
是否可以?
非常感谢
I've one place in my code where I free some ingres resources, and I've no way to know if the parameter is valid ingres resource.
So I would like to do it anyway(except if empty() ).
I'm try-catching it, but when this isnt a valid resource, I got the exception catched by cakePhp and then it display the debug message, and it mess with the encoding the whole site.
I know that I can't deactivate the debugging for the whole site, but the website is under development and it's not what I want.
So, how to manage cakePhp to DON'T display this warning for this exception on this line(I also don't want to ignore all errors of this type).
Is it possible?
Thank you very much
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 错误控制运算符 抑制错误/警告,但不会看到一些错误/警告代码无法提供更具体的建议。
@mysql_connect('localhost', 'root, 'pass');
@file('file.txt');
等等。
或者你可以尝试〜
我相信然而,有一种正确的方法来检查有效数据。你原来的帖子中的一些代码会有所帮助
You can suppress errors/warnings with the error control operator but without seeing some code can't advise more specifically.
@mysql_connect('localhost', 'root, 'pass');
@file('file.txt');
etc.
Or you could try ~
I'm sure there's a proper way to check for valid data however. some code in your original post would help
如果不是持久连接,PHP 将自动释放它: http:// www.php.net/manual/en/language.types.resource.php
If it's not a persistent connection, PHP will free it automatically: http://www.php.net/manual/en/language.types.resource.php