【问题标题】:Getting an element out of an XML Object With PHP使用 PHP 从 XML 对象中获取元素
【发布时间】:2012-01-21 03:01:39
【问题描述】:

我完全被这个问题困住了,非常感谢您的帮助!

我只需要将 ValidationCode 从这个现有的 XML 对象中提取出来。

这是我做的时候得到的:

print_r($response);

响应对象 ( [ResponseText] => xxxxxxxxx [ResponseXml] => SimpleXMLElement 对象 ( [ValidationRequest] => SimpleXMLElement 对象 ( [AccountSid] => xxxxxxxx [PhoneNumber] => +15555555555 [FriendlyName] => SimpleXMLElement 对象 ( ) [ValidationCode] => 601532 ) ) [HttpStatus] => 200 [Url] => https://api.dddddd.com//2010-04-01/Accounts/xxxxxx/OutgoingCallerIds [QueryString] => [IsError] => [ErrorMessage] => )

我如何使用 php 访问该验证码?

感谢您的帮助!

【问题讨论】:

    标签: php xml


    【解决方案1】:
    $code = $response->ResponseXml->ValidationRequest->ValidationCode;
    

    【讨论】:

    • 救命!谢谢你,朋友。我会尽快接受你的回答。
    【解决方案2】:
    $ValidationCode=$response->ResponseXml->ValidationRequest->ValidationCode;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-06
      • 1970-01-01
      • 1970-01-01
      • 2018-05-25
      • 2023-01-26
      相关资源
      最近更新 更多