Laravel Swift Mail发送带附件的邮件报错 “Swift_IoException The path cannot be empty“处理

复制代码
先说下情况,就是我要做一个发送附件的邮件发送功能,结果,报错:The path cannot be empty。

给我整的有点迷糊,网上也没有类似的问题。

后来,我检查了一下代码,发现有个地方,是需要给附件文件地址的:
php 复制代码
   /**
     * Get the mail representation of the notification.
     *
     * @param mixed $notifiable
     * @return \Illuminate\Notifications\Messages\MailMessage
     */
    public function toMail($notifiable)
    {
        return (new MailMessage)
            ->subject('获取报告发送通知')
            ->view('emails.sendReportFile',['data'=>$notifiable->data])
            ->attach($notifiable->report_url);
    }
复制代码
$notifiable->report_url就这个。

一检查这里的变量没值,所以,才导致了这个问题。

记录一下,希望有用。
相关推荐
wefly20173 小时前
免安装!m3u8live.cn在线 M3U8 播放器,小白也能快速上手
java·开发语言·python·json·php·m3u8·m3u8在线转换
luanma1509805 小时前
Laravel 10.x新特性全解析
php·laravel
Irene199113 小时前
JavaScript脚本加载的两种方式:defer/async 的区别
前端·javascript·php
luanma15098013 小时前
PHP vs C#:30字秒懂两大语言核心差异
android·开发语言·python·php·laravel
fresh hacker14 小时前
【Linux系统】通用的“系统排障”
linux·运维·服务器·网络·php
luanma15098014 小时前
Laravel 8.X重磅特性全解析
前端·javascript·vue.js·php·lua
luanma15098014 小时前
Laravel 9.x重磅升级:十大新特性解析
php·laravel
zhangren0246814 小时前
PHP vs C++:从Web脚本到系统编程的终极对比
开发语言·c++·php
luanma15098014 小时前
Laravel 7.X核心特性深度解析
android·开发语言·php·lua·laravel
IAUTOMOBILE16 小时前
两大王者-Laravel vs ThinkPHP:PHP 框架终极对决,谁更适合团队或者个人!
开发语言·php·laravel