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.
  • Related Article

    Contact Us

    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.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.