脚本宝典收集整理的这篇文章主要介绍了尝试Catch with PHP警告,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
例如
if (!$dom->loadhtmlFile($url)) { //if cant load file handle error my way }
对于我正在使用的$url我正在使用
Warning (2): DOMDocument::loadHTMLFile(MYURL) [domdocument.loadhtmlfile]: Failed to oPEn stream: HTTP request Failed! HTTP/1.0 403 Forbidden [APP\controllers\import_controller.PHP,line 62] Warning (2): DOMDocument::loadHTMLFile() [domdocument.loadhtmlfile]: I/O warning : Failed to load external entITy "hMYURL" [APP\controllers\import_controller.PHP,line 62]
我可以只是抑制错误,并在调用返回false时执行某些操作,但我希望能够捕获确切的警告消息,然后对其执行某些操作.
这可能吗?
谢谢
以上是脚本宝典为你收集整理的尝试Catch with PHP警告全部内容,希望文章能够帮你解决尝试Catch with PHP警告所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。