为了账号安全,请及时绑定邮箱和手机立即绑定

如何通过电子邮件 Laravel PHP 从表中发送 JSON 数据

如何通过电子邮件 Laravel PHP 从表中发送 JSON 数据

PHP
茅侃侃 2022-07-22 15:17:05
我想从各种下拉框中完成的 HTML 表中获取所有数据。我能够成功通过电子邮件发送所有输入字段,但无法弄清楚如何获取 JSON 数据。我已将表数据转换为 JSON,并且变量记录正常。没有后端数据库,所有数据都是客户端和静态 HTML。HTML<div class="row"><h4 class="info-text"> Tell us about yourself and the project you are working on.</h4><div class="col-sm-5 col-sm-offset-1">    <div class="form-group">        <label>Contact Name <small></small></label>        <input name="name" type="text" class="form-control" placeholder="Contact Name..." id="name">    </div>    <div class="form-group">        <label>Contact Number <small></small></label>        <input name="phone" type="text" class="form-control" placeholder="Number..." id="number">    </div></div><div class="col-sm-5 ">    <div class="form-group">        <label for="project">Please tell us a little about the project you are working on <small></small></label>        <textarea class="form-control" name="project" rows="5" id="project"></textarea>    </div></div><div class="col-sm-10 col-sm-offset-1">    <div class="form-group">        <label>Email <small></small></label>        <input name="email" type="email" class="form-control" placeholder="email@email.com" id="email">    </div></div><div class="col-sm-10 col-sm-offset-1">    <div class="form-group">        <label>Upload a file should you wish to</label>        <input name="file" type="file" class="btn btn-info" placeholder="email@email.com">    </div></div><table class="table">    <thead>        <tr>            <th scope="col">#</th>            <th scope="col">Product</th>            <th scope="col">Ancillary Quantity</th>            <th scope="col">Fire Rating</th>            <th scope="col">Void Gap (mm)</th>            <th scope="col">Cut Type</th>            <th scope="col">Quantity</th>            <th scope="col">Bracket Finish</th>        </tr>    </thead>    <tbody>        <tr>        </tr>    </tbody></table>这是用于表格数据的 jQuery 循环$("#next").click(function () {var table = $("table tbody");table.find('tr').each(function (i) {});
查看完整描述

1 回答

?
慕尼黑8549860

TA贡献1818条经验 获得超11个赞

在您的控制器上使用json_decode()

$tableData = json_decode($request->row, true); # true -- get as array

然后将 $tableData 传递给您的电子邮件刀片并打印。

https://www.php.net/manual/en/function.json-decode.php


查看完整回答
反对 回复 2022-07-22
  • 1 回答
  • 0 关注
  • 109 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信