php图片下载详解编程语言
2023-06-13 09:11:53 时间
$name=$_GET[name]; //获取图片地址$file = fopen($dir,"r"); // 打开文件
$dir=/www/image/;$ext=strrchr($name,".");
if($ext!=".gif" $ext!=".jpg" $ext!=".png")
return false;
$file_path=$dir.$name;
$size=filesize($file_path);
$file = fopen($file_path,"r") or die("file is not exist");; // 打开文件
Header("Content-type: application/octet-stream");
Header("Accept-Ranges: bytes");
Header("Accept-Length: ".$size);
Header("Content-Disposition: attachment; filename=" . $name);
echo fread($file,$size);
fclose($file);
exit;
}
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/20411.html
cjava相关文章
- PHP之与或非_php字符串运算符
- [PHP] 网盘搜索引擎-采集爬取百度网盘分享文件实现网盘搜索(二)详解编程语言
- [PHP] 网盘搜索引擎-采集爬取百度网盘分享文件实现网盘搜索详解编程语言
- [PHP] 自动加载的实现详解编程语言
- [PHP] 重回基础(date函数和strtotime函数)详解编程语言
- PHP设计模式_工厂模式详解编程语言
- PHP开发者成长图详解编程语言
- php laravel 创建项目 500报错解决方法详解编程语言
- php 根据ip获取地区的方法详解编程语言
- php curl请求返回NULL解决方法详解编程语言
- PHP去重的简单写法详解编程语言
- PHP str_replace的用法详解编程语言
- php微信卡券logo上传方法详解编程语言
- php charles 使用方法详解编程语言
- MongoDB的php可视化管理工具详解编程语言
- 查询使用PHP运行MySQL查询的步骤(php运行mysql)
- 利用PHP操作Redis变得更简单(php中redis的使用)
- PHP Redis实时监控系统的应用(php redis 监控)
- 简便快捷:在PHP服务器上使用MSSQL(php服务器 mssql)
- 使用php重新实现PHP脚本引擎内置函数