Can I try/catch a warning?

前端 未结 11 1047
孤城傲影
孤城傲影 2020-11-22 01:04

I need to catch some warnings being thrown from some php native functions and then handle them.

Specifically:

array dns_get_record  ( string $hostnam         


        
11条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-22 01:47

    If dns_get_record() fails, it should return FALSE, so you can suppress the warning with @ and then check the return value.

提交回复
热议问题