How PHP ignores a warning that a function throws out
Source: Internet
Author: User
How PHP ignores a warning that a function throws out
When I use PHP's Socket_connect function
If the server does not exist, then this function throws a
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
The warning
I want to block out this warning you can use error_reporting (e_all ^ e_notice), but you don't want to block out other warnings.
Is there a way to just block out the warning that this function throws out?
Or there is a way to do the test ahead of the past can be.
------Solution--------------------
@socket_connect ()
------Solution--------------------
First error_reporting (e_all ^ e_notice); Can't block out this error
You can use @socket_connect () to mask the wrong display
About this connection error, the manual has
Returns TRUE if successful, and FALSE if it fails. The error code can is retrieved with Socket_last_error (). This code is passed to Socket_strerror () to get a textual explanation of the error.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.