gpt4 book ai didi

php - 错误控制运算符(operator)不工作

转载 作者:行者123 更新时间:2023-12-04 06:20:43 25 4
gpt4 key购买 nike

我的问题与此类似 one .然而,error control operator对我不起作用。

使用以下代码:

$this->fp = @fsockopen($this->ip, $this->port, $errno, $errstr, $this->timeout);

我仍然收到一条错误消息:
fsockopen(): unable to connect to xxx.xxx.xxx.xx:xxxxx (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. )
我可以禁用错误控制运算符吗?

最佳答案

我发现了问题!我一直在使用我自己的错误处理程序

set_error_handler('my_error_handler');

如果 @,它会打印出错误而不管是否有前缀。

仅供引用 - 来自 php manual 的代码演示了如何在用户定义的错误处理程序中抑制错误:
// if error has been supressed with an @
if (error_reporting() == 0) {
return;
}

关于php - 错误控制运算符(operator)不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6610441/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com