Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/274.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php和swift中的post方法数组数据_Php_Swift - Fatal编程技术网

php和swift中的post方法数组数据

php和swift中的post方法数组数据,php,swift,Php,Swift,我使用post http方法发送数组数据,也就是说,我发送多个值。但现在我得到了一个空白输出。虽然我发布了formKATID,但没有得到任何结果。如何发送阵列数据 迅捷的 PHP 您正在发布一个字典,其中键为formKATID=,值为字符串5。然后在php代码中查找键formKATID。它们不相等,因此需要删除= 如果使用URLSession看起来令人困惑,我会做一个简单的选择,或者使用类似Alamorfire的东西来包装它,这样您所需要做的就是: networkUtils.post(url,

我使用post http方法发送数组数据,也就是说,我发送多个值。但现在我得到了一个空白输出。虽然我发布了formKATID,但没有得到任何结果。如何发送阵列数据

迅捷的

PHP


您正在发布一个字典,其中键为formKATID=,值为字符串5。然后在php代码中查找键formKATID。它们不相等,因此需要删除=

如果使用URLSession看起来令人困惑,我会做一个简单的选择,或者使用类似Alamorfire的东西来包装它,这样您所需要做的就是:

networkUtils.post(url, dictionary).then { data in
  // Use data response here
}.catch { error in
  // Catch error here
}

您不需要formKATID=中的=。当我卸载时,它不再工作@wyetro您卸载的是什么?你能确认服务器正在接收帖子吗?我删除了等号。是的,我可以。那么如果你把字典打印出来会怎么样?您看到了哪些键?虽然我已经删除了等号,但它仍然不起作用。它等于表中的KATEGORI.ID。当发送字符串值时,我按如下方式发送:let postString=formKATID=datatouploadit这不是我的意思。在$formKATID=$_POST['formKATID']行之后;,这个变量等于什么?它是空字符串还是空字符串?。如果将行切换到$formKATID=$\u POST['formKATID='];会怎么样;?
$formKATID = $_POST['formKATID'];

$tsql = "... WHERE KATEGORI.ID IN(".implode(', ',$formKATID).")";
$stmt = sqlsrv_query( $conn, $tsql);

while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) {
networkUtils.post(url, dictionary).then { data in
  // Use data response here
}.catch { error in
  // Catch error here
}