php警告重定向 [英] php warning redirect

查看:38
本文介绍了php警告重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 snmp2_real_walk 函数.

$tmp = snmp2_real_walk($ip, '***'.$vlan, $title, 100000,10);

当 oid 正确且设备正常工作时,我会得到所需的输出.但我想处理警告:Invalid object identifier...No response from 192.168.19.249... 或其他.我的问题是:如何将这些警告重定向到我的变量中?

When oid is correct and the device is working i get the desired output. But i want to handle warnings: Invalid object identifier... or No response from 192.168.19.249... or whatever. My problem is: how can i either redirect those warnings into my variable?

或者是否有其他函数显示这些警告?

or is there some another function which shows these warnings?

谢谢!

推荐答案

你也可以看看 set_error_handler为这种特定情况设置自己的错误处理程序,然后在进行函数调用后恢复错误处理程序.

You could also have a look at set_error_handler to set your own error handler for this specific case, and then restore the error handler after making the function call.

这篇关于php警告重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆