简单的 图片下载 php

/**
* @param Q_Request $input
* @param Q_Response $output
*/
public function doDownload(Q_Request $input, Q_Response $output)
{

$qrCodePath = "二维码路径/其他图片路径";

header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . basename($qrCodePath) . '"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($qrCodePath));
readfile($qrCodePath);
Q::end();
}
原文地址:https://www.cnblogs.com/liuqd001/p/9519573.html