我正试图从货运网络服务获取操作消息。
在我填充$ myArr数组的内部后,我正在向这样的Web服务发送请求;
$result = $client->queryShipment($myArr); // it asks to web server whether cargo exist or not
echo "<pre>";
var_dump($result);
echo "</pre>";
然后PHP结果是;
object(stdClass)#2 (1) {
["ShippingDeliveryVO"]=>
object(stdClass)#3 (5) {
["outFlag"]=>
string(1) "0"
["outResult"]=>
string(11) "Success"
["count"]=>
int(1)
["senderCustId"]=>
int(1012883)
["shippingDeliveryDetailVO"]=>
object(stdClass)#4 (6) {
["cargoKey"]=>
string(12) "645558612997"
["invoiceKey"]=>
string(10) "41db64ff4f"
["jobId"]=>
int(4006477)
["operationCode"]=>
int(0)
["operationMessage"]=>
string(25) "There is no process with cargo."
["operationStatus"]=>
string(3) "NOP"
}
}
}
我需要从$ result中获取只有operationMessage的值。我怎么能这样做?
答案 0 :(得分:1)
它很简单..
echo $result->ShippingDeliveryVO->shippingDeliveryDetailVO->operationMessage;
答案 1 :(得分:1)
尝试:
$operationMessage = $result->ShippingDeliveryV0->shippingDeliveryDetailV0->operationMessage;