国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

webman 讓用戶下載動態(tài)生成的數(shù)據(jù) 限制速度

shixia

我在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)

1527 1 0
1個回答

walkor 打賞

webman不支持限速。打印輸出用ob_start()ob_get_clean() 來獲取。

$arr = str_split($data, 204800);
$num = count($arr);
ob_start();
for ($i = 0; $i < $num; $i++) {
    print $arr[$i];
}
$content = ob_get_clean();
return response($content);
  • 暫無評論
年代過于久遠,無法發(fā)表回答
??