时间:2021-07-01 10:21:17 帮助过:4人阅读
具体如下:
//下载
function downregcaseAction() {
$file="upload/regcase.jpg";
if(isfile($file)) {
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=".basename(file));
readfile(file);
exit;
} else {
echo "文件不存在!";
exit;
}
}以上就是本文的全部内容,希望对大家的学习有所帮助。
相关推荐:
PHP中PDO事务处理操作示例
PHP中类自动加载的方式
PHP简单实现解析xml为数组的方法
以上就是php实现文件或图片强制下载的方法的详细内容,更多请关注Gxl网其它相关文章!