Article From:https://segmentfault.com/q/1010000009603024
Question:

Now the PHP side takes WebService from the Java side, and the map type of Java will not be encapsulated.
There are two known formats:

  1. For arrays of Java, we use PHP arrays to match them.

  2. For Java objects, we use stdClass to correspond.

So, how to encapsulate the PHP side for the map type of Java. Worry about people. Ask God for help.

Answer 0:

To help you distinguish:

  1. java.util.List The package is array, but the array key is an integer eg: $arr[0] of increment int type = “AAA”;

  2. java.util.Map The package is array, but the key of this array is string, the key value pair. Eg: $arr[“a”] = “AAA”;

Answer 1:

php Array covers many types of other languages.
You can use PHP array to correspond to Java map.

Leave a Reply

Your email address will not be published. Required fields are marked *