时间:2021-04-18加入收藏
<?php
$slurl = 'https://www.bingdou.com.cn';
$ch = curl_init();
$timeout = 10;
curl_setopt ($ch, CURLOPT_URL, $slurl);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$contents = curl_exec($ch);
if(false == $contents){?>无法访问
<?php }else{?>可以访问
<?php }?>