這篇文章主要介紹了php實現改變圖片直接打開為下載的方法,涉及php操作圖片下載的技巧,非常具有實用價值,需要的朋友可以參考下
本文實例講述了php實現改變圖片直接打開為下載的方法。分享給大家供大家參考。具體如下:
process.php文件如下:
- $file = $_GET['file'];
- header("Content-type: octet/stream");
- header("Content-disposition:attachment;filename=".$file.";");
- header("Content-Length:".filesize($file));
- readfile($file);
- exit;
html文件如下:
- <a href="process.php?file=pic.jpg">Image goes Here</a>
希望本文所述對大家的php程序設計有所幫助。
新聞熱點
疑難解答