How does PHP ignore the Warning thrown by a function? if the SERVER does not exist when using the socket_connect function of PHP, this function will throw a Warning: socket_connect () [function. socket-connect]: unabletoconnect [111]: Connectionrefusedindatarele PHP how to ignore the warning thrown by a function
When I use the socket_connect function of PHP
If the SERVER does not exist, this function will throw
Warning: socket_connect () [function. socket-connect]: unable to connect [111]: Connection refused in/data/release/oc/trunk/system/class/Log. class. php on line 79
Warning
To block this warning, use the error_reporting (E_ALL ^ E_NOTICE) function, but do not want to block other warnings.
Is there a way to block only warnings from this function?
Or is there any way to perform detection in advance.
------ Solution --------------------
@ Socket_connect ()
------ Solution --------------------
Error_reporting (E_ALL ^ E_NOTICE); the error cannot be blocked.
You can use @ socket_connect () to block error display.
This connection error is found in the manual.
If the call succeeds, TRUE is returned. if the call fails, FALSE is returned. The error code can be retrieved with socket_last_error (). This code may be passed to socket_strerror () to get a textual explanation of the error.