codeigniter - 无法发送存储在数据库中的电子邮件附件 - Codeigniter
问题描述
我有一个用户附加文件的表单。该文件被上传到一个文件夹,然后 full_path 链接存储在数据库中。该链接与其他项目一起以数组格式存储。这是它在数据库中的存储方式。
[{"product_id":"20","product_name":"C4(Big A4) Envelopes","quantity":"1000","image":"\"\\\/home\\\/printlin\\\/public_html\\\/uploads\\\/birthday24.jpg\""}]
现在,当我想发送电子邮件时,我对存储在数据库中的数据进行解码并将 file_path 放在 attach() 函数中。
foreach ($data['shopping_cart'] as $cart_data) {
$items = json_decode($cart_data['items'],true);
foreach ($items as $documents){
$this->email->attach(stripcslashes($documents['image']));
}
}
电子邮件已发送,但不附带任何附件。($documents['image']) 显示为:
"\/home\/printlin\/public_html\/uploads\/birthday28.jpg"
stripcslashes($documents['image']) 显示为:
"/home/printlin/public_html/uploads/birthday28.jpg"
我的链接格式可能有什么问题?
解决方案
推荐阅读
- c# - nameof(NotNullValidator) 不适用于 .Net5 和 FluentValidation 10
- visual-studio-code - vscode中的自动右引号
- python - 将文本文件中的列拆分为数组
- maven - Jenkins - 如何在第二个 maven 命令中使用第一个 maven 命令的输出?
- reactjs - 反应 devtools 跟踪 redux 操作
- laravel - Laravel 嵌套资源控制器策略
- django - 如何在 Django 模型上添加复杂的约束?
- swiftui - 当@FetchRequest 谓词过滤器更改时,将 SwiftUI @FetchedResults 计数从子视图返回到父视图
- android - 从按钮继承 onClick 属性
- javascript - React 组件输入验证(useState())落后一步