How does PHP ignore the warning thrown by a function?

Source: Internet
Author: User
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]: How does unabletocon PHP 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.

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.