河汉清且浅,牵牛敦而纯
    set_error_handler(function($err_severity, $err_msg, $err_file, $err_line, array$err_context){
        throw new ErrorException($err_msg, 0, $err_severity, $err_file, $err_line);
    }, E_WARNING);
    try{
        $resource = file_get_contents($url);
    }
    catch(Exception $e){
        $error = $e -> getMessage();
        if(!empty($error)) die("<pre><b>获取数据失败\r\n$error\r\n</b></pre>");
    }
    # restore the previous error handler 还原以前的错误处理程序
    restore_error_handler();

  

posted on 2022-02-02 21:07  伊索  阅读(227)  评论(0编辑  收藏  举报