zl程序教程

您现在的位置是:首页 >  后端

当前栏目

php破解防盗链图片函数

PHP破解 函数 图片 防盗链
2023-06-13 09:14:07 时间

复制代码代码如下:


<?php
$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;
}
?>