从MySQL流二进制文件以使用PHP下载

从MySQL流二进制文件以使用PHP下载,第1张

从MySQL流二进制文件以使用PHP下载
function getfile($blockid){    global $msa_db;    $sql = "select filename, filedata from blocks where blockid = '$blockid'";    $query = mysql_query($sql, $msa_db);    $result['filename'] = mysql_result($query,0,0);    $result['filedata'] = mysql_result($query,0,1);    return $result;}function download($fileinfo){    $file = base64_depre($fileinfo['filedata']);    header("Cache-Control: no-cache private");    header("Content-Description: File Transfer");    header('Content-disposition: attachment; filename='.$fileinfo['filename']);    header("Content-Type: application/vnd.ms-excel");    header("Content-Transfer-Encoding: binary");    header('Content-Length: '. strlen($file));    echo $file;    exit;}$fileinfo = getfile($blockid);download($fileinfo);


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/4986486.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-14
下一篇 2022-11-14

发表评论

登录后才能评论

评论列表(0条)

保存