您应该为数据选择一种序列化方法。例如,XML,协议缓冲区或JSON。
我个人建议您使用JSON,因为它是轻量级的,甚至对于人类来说也易于阅读,并且有两种语言可供选择的库。
在PHP端进行编码
$enpred = json_enpre($data);
用Jackson解码Java端
final ObjectMapper objectMapper = new ObjectMapper();// the better way is to create a custom class with the correct formatfinal Map<?, ?> depred = objectMapper.readValue(enpred, Map.class);



