//检测网络是否连接function varify_url($url){ $check = @fopen($url,"r"); if($check){ $status = true; }else{ $status = false; } return $status; } //by bbs.it-home.org复制代码调用示例: $url = "http://bbs.it-home.org"; if(varify_url($url)){ echo "Congratulation ! Your URL $url : is valid "; }else{ echo "Error ! 你提供的URL : $url is invalid "; } 复制代码