冰豆网

分享网络精彩
bingdou.com.cn

PHP函数来判断这个网站是否能正常打开

时间: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 }?>

打 赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

TGA: php 技巧

分享到:


官方微信二维码冰豆网官方微信公众号