0

请帮帮我......我正在努力解决这个问题..

问题 如何FirstName在 PHP 中从中获取价值...

GetReportResponse Object
(
[GetReportResult] => MBPeopleSearchRs_Type Object
    (
        [MsgRsHdr] => MsgRsHdr_Type Object
            (
                [RqUID] => {29B1A627-D908-4A57-BC17-8E2592DC154A}
                [Status] => Status_Type Object
                    (
                        [StatusCode] => 0
                        [ServerStatusCode] => 
                        [Severity] => Info
                        [StatusDesc] => OK
                        [AdditionalStatus] => 
                    )

            )

        [Subject] => Subject Object
            (
                [RefNum] => 
                [PersonInfo] => PersonInfo_Type Object
                    (
                        [PersonName] => PersonName_Type Object
                            (
                                [LastName] => JANARDHANAN
                                [FirstName] => SENTHINBABU
                                [FullName] => 
                                [MiddleName] => 
                                [TitlePrefix] => 
                                [NameSuffix] =>  
                                [Nickname] => 
                                [LegalName] => 
                                [MaidenName] => 
                                [OfficialTitle] => 
                                [Source] => MB
                                [EffDt] => 2013-05-24
                            )
4

2 回答 2

0
function getFirstName(GetReportResponse $response) {
    return $response->GetReportResult->Subject->PersonInfo->PersonName->FirstName;
}

现在您可以按如下方式使用此功能:

$firstName = getFirstName($response); // $response var here represents your response object
于 2013-05-25T10:03:53.590 回答
0

你可以试试这个:

$xml = simplexml_load_string($response);
foreach ($xml->xpath('//GetReportResult//Subject//PersonInfo//PersonName//FirstName') as $item)
{
    var_dump($item);

}

其中 $response 是对 wsdl 中函数的调用。

于 2013-05-25T09:47:50.240 回答