更新时间:2022-05-09 04:58:03
要在查询字符串中将数组传递给 php,您应该将 []
添加到 identifier 并将每个项目添加为单独的条目,因此这样的事情应该可以工作:
To pass an array to php in query string, you should add []
to identifier and add every item as separate entry, so something like this should work:
nameValuePairs.add(new BasicNameValuePair("devices[]", device1));
nameValuePairs.add(new BasicNameValuePair("devices[]", device2));
nameValuePairs.add(new BasicNameValuePair("devices[]", device3));
现在,php 端的 $_POST['devices']
将包含一个数组.
now, $_POST['devices']
on php side will contain an array.