更新时间:2021-09-04 05:36:06
步骤1:检查返回码: if($ content === FALSE){// handle error here ...}
Step 1: check the return code: if($content === FALSE) { // handle error here... }
步骤2:通过放置 file_get_contents()之前的错误控制运算符(即 @
): $ content = @file_get_contents($ site);
Step 2: suppress the warning by putting an error control operator (i.e. @
) in front of the call to file_get_contents():
$content = @file_get_contents($site);