Home  >  Q&A  >  body text

java - PHP calls the map type of webservice, how to encapsulate it?

Now when the PHP side calls the webservice on the Java side, the map type for Java will not be encapsulated.
There are two known formats:

  1. For Java arrays, we use PHP arrays to correspond.

  2. For java objects, we use stdclass to correspond.

So for the map type of Java, how to encapsulate it on the PHP side. . Worrying people. . Ask God for help.

PHP中文网PHP中文网2663 days ago831

reply all(2)I'll reply

  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-06-05 11:12:20

    Help you distinguish:

    1. java.util.List is encapsulated as an array, but the key of this array is an integer of increasing int type. eg: $arr[0] = "aaa";

    2. java.util.Map is encapsulated as an array, but the key of this array is string, key-value pair. eg: $arr["a"] = "aaa";

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-06-05 11:12:20

    PHP’s array covers many types of other languages.
    You can completely use php array to correspond to java map.

    reply
    0
  • Cancelreply