1

我有这个代码:

        $response = $excelService->getResponse(); // create response for excel object bundle
        $response->headers->set('Content-Type', 'text/vnd.ms-excel; charset=utf-8');
        $response->headers->set('Content-Disposition', 'attachment; filename='.basename('filename.xls'));
        $response->headers->set('Pragma', 'public');
        $response->headers->set('Cache-Control', 'maxage=1');
        $response->sendHeaders();
        return $response;

当我单击将此文件下载到我的磁盘时,它的名称是:filename.xls, attachment 我怎样才能从我的文件名中删除这个“附件”?

4

1 回答 1

2

你需要删除$response->sendHeaders();

于 2013-10-02T17:00:15.340 回答