PHP解决盗链图片无法显示的问题

来源:互联网 发布:java的前景 编辑:程序博客网 时间:2024/06/09 05:25
    header('Content-type: image/jpeg');    $context=array('http' => array ('header'=> 'Referer: http://www.baidu.com/',),);    $xcontext = stream_context_create($context);    echo $str=file_get_contents($url,FALSE,$xcontext);

主要是针对Referer验证防护的盗链解决办法,在前端对加载的图片url进行改写,执行此脚本作为中转。

0 0
原创粉丝点击