从 PHP 中的 Object 获取特定值 [英] Get specific value from Object in PHP
本文介绍了从 PHP 中的 Object 获取特定值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<?php
$a['registrationID']="*******";
$a['password']="******";
$a['smsPort']=7424;
$a['msgID']=0;
$soap_url='http://localhost/WebService_GP_ADP_BizTalk_SMS_Orchestrations.wsdl';
$soap = new SoapClient($soap_url);
$response=$soap->getReceivedSMS( array ("ReceiveSMSRequest" => $a) );
print_r($response);
?>
<小时>
返回:
stdClass Object
(
[ReceiveSMSResponse] => stdClass Object
(
[msgID] => 20100620202512840316
[senderMSISDN] => 1732172782
[timeStamp] => 6/20/2010 8:25:14 PM
[msgContent] => testing
[sourcePort] => 7424
)
)
如何获取对象的不同部分并将它们分别放入字符串中?例如我想要类似 $msgcontent=//[msgcontent]
How do I get the different parts of the object and put them separately into strings? e.g. i want something like $msgcontent= //whatever is in [msgcontent]
推荐答案
使用 ->
运算符.在您的具体示例中:
Use the ->
operator. In your specific example:
print($response->ReceiveSMSResponse->msgContent);
有关更多信息,请参阅:http://www.php.net/manual/en/language.oop5.properties.php
For more information, see: http://www.php.net/manual/en/language.oop5.properties.php
这篇关于从 PHP 中的 Object 获取特定值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文