gpt4 book ai didi

php - 我需要使用 PHP 在电子邮件中从我的应用程序中获取一个数组

转载 作者:行者123 更新时间:2023-11-28 08:19:47 24 4
gpt4 key购买 nike

我有一个表格 View ,我想通过使用 PHP 单击一个按钮来通过电子邮件发送该数据。 tableview 数据来自一个array。正如您在下面的代码中看到的那样,我设法在我的电子邮件中获取了一个变量,但不是一个数组(例如我的 TableView 中的数据)有人可以帮助我吗?

func postToServerFunction() {

let myUrl = NSURL(string: "http://www.aaa.com/be/file.php")
let request = NSMutableURLRequest(url: myUrl! as URL)
let userTotal = String(cartBrain.total)
var bodyData = "data=\(userTotal)"
request.httpMethod = "POST"
request.httpBody = bodyData.data(using: String.Encoding.utf8)
let task = URLSession.shared.dataTask(with: request as URLRequest)

}

和我的 PHP 代码:

<?php
$postVar = $_POST['data'];
if(!empty($postVar)){
mail(“userEmail”,”email verzonden", $postVar);
}
?>

最佳答案

您在代码中使用了错误的 ,因此无法正常工作。

$postVar = $_POST['data'];
if(!empty($postVar)){
mail("userEmail","email verzonden", $postVar); // replace ” with "
}

关于php - 我需要使用 PHP 在电子邮件中从我的应用程序中获取一个数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41631651/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com