return response ()->download ($pathToFile); 调用这个函数没反应?

代码

    /**
     * 导出excel
     */
    public function exportExl()
    {
        $result = Excel::download(new InvoicesExport, 'invoices.xlsx');
        $absPath = $result->getFile()->getPathname();
//        $path = $result->getFile()->getPath();
//        $fileName = $result->getFile()->getFilename();
//        $testPath = public_path('images/fa9e99dce6a114bc77e929f9ed94a959.jpg');
        $info = response()->download($absPath, 'info.xlsx');
    }

$absPath 是绝对路径。

@李山河
你看我吊吗啊
《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
你看我吊吗啊
最佳答案
5年前 评论
讨论数量: 3
你看我吊吗啊

...有反应 ,下载了,其实。 只不过覆盖了原来的文件而且没有重命名。。。

5年前 评论
你看我吊吗啊
5年前 评论

发的什么玩意地址

3年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!