瑞鲁手机APP下载网_专注推荐好用的手机APP和游戏APP

破解防盗链图片的php函数

破解防盗链图片的php函数

查看人次:1摘自:瑞鲁游戏APP

现在很多网站和论坛的图片都在使用防盗链技术,既然有防盗链,那么肯定就有破解防盗链的方法啦,下面小编就来为你提供一个破解防盗链图片的php函数。不过只支持jpg和gif 哦,如果想支持多种图处格式,大家可以做下修改。

$url=$_GET['url'];

$ext=pathinfo($url,PATHINFO_EXTENSION);

if($ext!='jpg' && $ext!='gif'){ // 只支持jpg和gif

readfile('/upload/20081209130557536.gif');

exit;

}

$file=md5($url).'.'.$ext;

if(file_exists($file)){

readfile($file);

exit;

}else{

$data=file_get_contents($url);

if(!$data){ // 读取失败

readfile('/upload/20081209130557536.gif');

exit;

}

$handle=fopen($file,'wb');

fwrite($handle,$data);

fclose($handle);

echo $data;

}

?>

相关文摘:PHP教程 php|防盗链
标题名称:《破解防盗链图片的php函数》
本文网址:https://www.sdruilu.cn/news/tpart-53025.html