我在tp6中是已經(jīng)有了解決方案的,但是在webman中這個方法并不適用
以下是TP6中的代碼
private function down($data)
{
header("Cache-Control: max-age=0");
header("Content-Description: File Transfer");
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . date('Y-m-d h:i:s', time()) . '.txt"');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Pragma: public');
header('Cache-Control: must-revalidate');
ob_flush();
flush(); // 刷新內(nèi)容
$arr = str_split($data, 204800);
$num = count($arr);
for ($i = 0; $i < $num; $i++) {
print $arr[$i];
ob_flush();
flush();
sleep(1);
}
return response('');
}
但是由于在webman中 任何打印輸出函數(shù)都會輸出到控制臺暫時沒想到解決方案 想加群也沒有反應(yīng)