怎樣用php顯示這張圖片

來源:互聯網
上載者:User
http://7xigfd.com1.z0.glb.clouddn.com/wp-content/uploads/2015/08/134.jpg


function image($url, $referer_url) {
//$url = $this->input->get('url');
$dir = pathinfo($url);
$host = $dir['dirname'];
$refer = $host . '/';

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_REFERER, $refer);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, $referer_url);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)"); //類比使用者使用的瀏覽器
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); //在發起串連前等待的時間,如果設定為0,則無限等待
curl_setopt($ch, CURLOPT_TIMEOUT, 30); //設定逾時限制防止死迴圈
$data = curl_exec($ch);
curl_close($ch);

$ext = strtolower(substr(strrchr($url, '.'), 1, 10));
$types = array(
'gif' => 'image/gif',
'jpeg' => 'image/jpeg',
'jpg' => 'image/jpeg',
'jpe' => 'image/jpeg',
'png' => 'image/png',
);
$type = $types[$ext] ? $types[$ext] : 'image/jpeg';
header("Content-type: " . $type);
echo $data;
}這種方法不行 有沒有可用的方法?


回複討論(解決方案)

echo "";
這樣不行嗎?

echo "";
這樣不行嗎?


你試了可以嗎?

總不能無中生有吧?

總不能無中生有吧?



http://7xigfd.com1.z0.glb.clouddn.com/wp-content/uploads/2015/08/135.jpg 這張圖打不開吧

總不能無中生有吧?



http://knewsmart.com/applefan/9423/ 原圖在這裡,開啟這個然後上面那張圖就可以開啟了

圖片不存在或沒有許可權訪問。

圖片不存在或沒有許可權訪問。



有辦法hack嗎?



我%……&*))(*
我試過用http://7xigfd.com1.z0.glb.clouddn.com作來源就是沒用knewsmart.com
快被自己蠢哭了

非常感謝!
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.