checkConnection('static.dgdate.net'), 'google.com' => checkConnection('google.com'), 'baidu.com' => checkConnection('baidu.com') ]; /** * 检查域名连接状态 */ function checkConnection($domain) { $connected = @fsockopen($domain, 80, $errno, $errstr, 3); if ($connected) { fclose($connected); return ['status' => 'connected', 'message' => '连接成功']; } else { return ['status' => 'failed', 'message' => '连接失败']; } } ?>