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

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

记录一下,希望有用。
相关推荐
Maybe I Simple8 小时前
MySql 数据库分表 简单思路
数据库·php·webman
马达加斯加D11 小时前
C# --- Stream
服务器·c#·php
JaguarJack17 小时前
7 个从入门到资深 PHP 开发者都在用的核心调试技能
后端·php·服务端
BingoGo17 小时前
7 个从入门到资深 PHP 开发者都在用的核心调试技能
后端·php
码龄3年 审核中19 小时前
Linux record 05
linux·服务器·mysql·php
ELI_He9991 天前
hyperf auth模块
后端·php
2201_761199041 天前
7.statefulset
开发语言·kubernetes·php
yenggd1 天前
wireshark常规用法
测试工具·wireshark·php
韩师傅1 天前
从重启马车到常驻运输队:CGI 与 PHP 的物流系统演进简史
java·后端·php
不瘦80斤不改名2 天前
Python 日志(logging)全解析
服务器·python·php