Heim >Backend-Entwicklung >PHP-Tutorial >php 破解防盗链图片函数_PHP教程

php 破解防盗链图片函数_PHP教程

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-21 15:48:34821Durchsuche

复制代码 代码如下:

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

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/319698.htmlTechArticle复制代码 代码如下: ?php $url=$_GET['url']; $ext=pathinfo($url,PATHINFO_EXTENSION); if($ext!='jpg' $ext!='gif'){ // 只支持jpg和gif readfile('/upload/20081209130557536.gi...
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn