I m posting an array of ids and want to loop over those values. I m trying the following to populate an array with key/value pairs but it looks like the array is coming out empty.
$arr = array();
foreach($_POST[ ids ] as $id)
{
$arr[$id] = GetStuff($id);
}
<><>UPDATE: 象阵列一样的眼光是有人用的罚款。 I m试图通过照读echo json_encode(arr)
归还阵列内容,但答复是空白。
这里是var($_POST);
array(1) {
["ids"]=>
array(18) {
[0]=>
string(6) "156795"
[1]=>
string(6) "156800"
[2]=>
string(4) "4292"
[3]=>
string(6) "796053"
[4]=>
string(6) "660520"
[5]=>
string(4) "4293"
[6]=>
string(4) "4287"
[7]=>
string(6) "488339"
[8]=>
string(6) "837701"
[9]=>
string(7) "1152093"
[10]=>
string(7) "1186434"
[11]=>
string(7) "1324432"
[12]=>
string(6) "796051"
[13]=>
string(6) "144860"
[14]=>
string(5) "15065"
[15]=>
string(7) "1324434"
[16]=>
string(5) "13066"
[17]=>
string(4) "6969"
}
}