浏览器下载文件,支持ie浏览器

meilikeai0123    2022-02-09 19:24:03    1592
$file_url = hlp_request::get('img_path');
//判断图片是否带有协议
if (mb_substr($file_url, 0, 4) != 'http') {
    $file_url = 'https:' . $file_url;
}
$filename = basename($file_url); //要下载文件的名字
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=" . ($filename));
readfile($file_url);
return;