0

我正在创建一个用于在 PHP 中下载的文本文件,但它的末尾总是有一堆数字 1,例如 1111111111111111111111 无论我是否刷新缓冲区都会发生这种情况。输出本身很好。它最后只有这个无关紧要的垃圾。有什么线索吗?

function exportMyOrders() {
    $output = $this->getMyOutput();

    // Push the report.
    $today = getdate();
    $today_str = $today['year'].'-'.$today['mon'].'-'.$today['mday'];
    $export_file = 'MyFileName_'.$today_str.'.txt';
    header("Content-Description: File Transfer");
    header("Content-Disposition: attachment; filename=" . urlencode($export_file));
    header("Content-Type: application/force-download");
    header("Content-Type: application/octet-stream");
    header("Content-Type: application/download");
    header("Pragma: no-cache");
    header("Expires: 0");
    //      flush();

    print $output;
    die();
}
4

1 回答 1

-1

啊哈!我找到了。在创建输出的函数中,我有以下内容:

$output .= print($next_order);

不知道我为什么这样做。用一个简单的方法纠正它:

$output .= $next_order;

呃!

于 2013-06-07T18:18:10.110 回答