First, to transfer an array from a page to server a in PHP, multiple spaces on the page must have the same name, and the name must be "AA []", note that you need to add an array symbol so that it can be obtained on server,
$_POST[aa]
The result is an array.
A deeper problem is that, if I need to process the parameters in post and then send them to another server, how should I pass the AA parameter?
If no processing is done, after the POST request is assembled, server B will always get the array and cannot get the actual value.
The solution is: Now server a is serialized and then deserialized after server B receives the request. In this way, the deserialization value is an array, which is the same as that obtained in section.
Serialization
$_POST["aa"] =serialize($_POST[aa]);
Deserialization
$a = "a:2:{i:0;s:1:\"1\";i:1;s:1:\"2\";}";var_dump(unserialize($a));
What is the result:
array(2) { [0]=> string(1) "1" [1]=> string(1) "2"}
The serialized parameters obtained in post are added with escape characters, which need to be removed before deserialization is successful.
$bb = $_POST["aa"$bb = str_replace("\\", '', $bb);var_dump(unserialize($a));
Well, this is the result you want.
Of course, another problem is that you can directly pass the array value to a space on the page and submit it to the server. In this case, serialization and deserialization are also required.
Page
<Input type = "hidden" name = "AA" value = "<? PHP echo base64_encode (serialize ($ array);?> "/> Var_dump (base64_decode (unserialize ({1}Post ['Post _ data']);
I don't know what the function of adding this base64_encode seems to be for Chinese encoding?