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就这个。

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

记录一下,希望有用。
相关推荐
4***5720 小时前
PHP进阶-在Ubuntu上搭建LAMP环境教程
开发语言·ubuntu·php
Q_Q51100828520 小时前
python+django/flask+vue的基于文学创作的社交论坛系统
spring boot·python·django·flask·node.js·php
Q_Q51100828521 小时前
python+django/flask网红酒店预定系统
spring boot·python·django·flask·node.js·php
半路_出家ren21 小时前
LNMP环境与应用配置
linux·数据库·mysql·nginx·网络安全·php·lnmp
Q_Q51100828521 小时前
python+django/flask+vue的高考志愿咨询系统
spring boot·python·django·flask·node.js·php
Q_Q196328847521 小时前
python+django/flask+vue的电子产品销售系统
spring boot·python·django·flask·node.js·php
Q_Q51100828521 小时前
python+django/flask+vue的小型房屋租赁系统
spring boot·python·django·flask·node.js·php
y***61311 天前
PHP操作redis
开发语言·redis·php
Q_Q19632884751 天前
python+django/flask+vue的高铁火车铁路订票管理系统
spring boot·python·django·flask·node.js·php