从我的SOAP服务中,我如何更改从此soap服务获得的数据:
Array
(
[NE] => 42616324457
[EMAIL] => bertho_joris@yahoo.co.id
[TIPE] => POSTPAID
[NAMA] => ALBERTHO
[TELP] => 0812345678
[DN] => 127272748174
[STATUS_LOGIN] => 1
[DESC_LOGIN] => Valid
)
成为这样的形式:
Array
(
[0] => stdClass Object
(
[id] => 1
[NE] => 42616324457
[EMAIL] => bertho_joris@yahoo.co.id
[TIPE] => POSTPAID
[NAMA] => ALBERTHO
[TELP] => 0812345678
[DN] => 127272748174
[STATUS_LOGIN] => 1
[DESC_LOGIN] => Valid
[PASSWORD] => malaquena
)
)
我的SOAP服务代码:
<?php
require_once('lib/nusoap.php');
$Email = $_GET['email'];
$Password = $_GET['pass'];
$client = new nusoap_client('http://vcare.telkomvision.net.id/services/VcareServices.php');
$BacaSOAP = $client->call('validateLogin', array('EMAIL' => $Email, 'PASSWORD' => md5($Password)));
?>
请帮我改变
上数组的格式答案 0 :(得分:1)
只是投射到对象:
$array = array('A' => 0, 'B' => 1);
$array = array((object)$array);
print_r($array);
结果:
Array (
[0] => stdClass Object (
[A] => 0
[B] => 1
)
)
答案 1 :(得分:0)
创建一个stdClass
$data = array(
'ne' => 1231232,
'email' => 'asdasdsda'
);
$object = new stdClass();
foreach($data as $key => $value) {
$object->$key = $value;
}
print_r($object);