You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
698 B
33 lines
698 B
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace longbingcore\tools;
|
|
class LongbingImg
|
|
{
|
|
/**
|
|
* 检查远程图片是否存在
|
|
*
|
|
* @param $imgUrl
|
|
* @return bool
|
|
* @author shuixian
|
|
* @DataTime: 2019/12/28 10:17
|
|
*/
|
|
public static function exits($imgUrl) {
|
|
|
|
if(empty($imgUrl)){
|
|
return false ;
|
|
}
|
|
|
|
$ch = curl_init();
|
|
curl_setopt($ch, CURLOPT_URL,$imgUrl);
|
|
curl_setopt($ch, CURLOPT_NOBODY, 1); // 不下载
|
|
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|
|
|
if(curl_exec($ch)!==false)
|
|
return true;
|
|
else
|
|
return false;
|
|
|
|
}
|
|
} |