【问题标题】:WSDL Output to PHP var?WSDL 输出到 PHP var?
【发布时间】:2018-01-05 07:20:37
【问题描述】:

我从 WSDL 源获得此输出。 现在我想将所有部分保存在 PHP 变量中。 但是我怎么能分割这个大东西呢?前锋?任何想法? 我希望所有信息都包含在不同的变量中。

$response 中的所有数据..

$response = $client->getAllEventInfos('12345');
print_r($response);

这就是输出...

stdClass Object ( 
[beautifulDate] => 01.05.2018 20:00 - 21:00 
[concernedPersons] => Array ( 
[0] => stdClass Object ( 
    [item] => Array ( 
        [0] => John Doe 
        [1] => Vortragender 
        [2] => ) ) ) 
[eventPool] => stdClass Object ( 
    [id] => 1 
    [institutionName] => ASM Rechnungen 
    [name] => ASM ) 
    [eventdates] => Array ( 
        [0] => stdClass Object ( 
            [item] => Array ( 
                [0] => 01.05.2018 von 20:00 bis 21:00 
                [1] => Zwettl 
                [2] => 01.05.2018 20:00 
                [3] => 01.05.2018 21:00 ) ) ) 
[fullyBooked] => 
[id] => 10011 
[name] => Besuch des Präsidenten 
[registrationEndDate] => 25.12.2018 
[registrationLink] => https:example.com 
[registrationStartDate] => 01.01.2018 
[startDate] => 01.05.2018 
[wsEventDates] => Array ( 
    [0] => stdClass Object ( 
        [beginTime] => 01.05.2018 20:00 
        [endTime] => 01.05.2018 21:00 
        [periode] => 01.05.2018 von 20:00 bis 21:00 
        [venueName] => Zwettl ) ) 
[iCalLink] => https://example.com )

【问题讨论】:

  • 为什么需要这样做?它现在已经可以访问,并且可以立即使用。例如 echo $response->beautifulDate;
  • 还有关于“相关人员”的信息!例如,我怎样才能得到 john doe?

标签: php xml wsdl


【解决方案1】:

这是对您评论的回应

循环关注的人数组,如:

foreach($response->concernedPersons as $person) {
      foreach($person->item as $item){
            echo $item."<br>";
      }

}

【讨论】:

    猜你喜欢
    • 2020-09-12
    • 1970-01-01
    • 2015-02-22
    • 2019-10-14
    • 1970-01-01
    • 2016-11-23
    • 1970-01-01
    • 2017-04-23
    • 1970-01-01
    相关资源
    最近更新 更多