PHP头条
热点:

破解防盗链图片的php函数


  现在很多网站和论坛的图片都在使用防盗链技术,既然有防盗链,那么肯定就有破解防盗链的方法啦,下面小编就来为你提供一个破解防盗链图片的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;

  }

  ?>

www.phpzy.comtrue/php/3607.htmlTechArticle破解防盗链图片的php函数 现在很多网站和论坛的图片都在使用防盗链技术,既然有防盗链,那么肯定就有破解防盗链的方法啦,下面小编就来为你提供一个破解防盗链图片的php函数。不...

相关文章

    暂无相关文章
相关频道:

PHP之友评论

今天推荐