Php 从try-catch中对象内部的数组中获取内容

Php 从try-catch中对象内部的数组中获取内容,php,arrays,web-services,object,soap,Php,Arrays,Web Services,Object,Soap,目前,我正在使用try-catch来确定web服务是否可调用: try { WebServices::create($this->nameWS); } catch (Exception $e) { var_dump($e); } 现在,$e包含错误消息以及包含数组的对象,如下所示 注意:看似随机的“位于第三行下方,再次靠近末尾 我确信您可以看到我正在尝试获取的字符串-这是我在代码中唯一剩下的字符串-“GetMeService”

目前,我正在使用
try-catch
来确定web服务是否可调用:

try {
  WebServices::create($this->nameWS);
}
catch (Exception $e) {                      
  var_dump($e);     
}
现在,
$e
包含错误消息以及包含数组的对象,如下所示

注意:看似随机的
位于第三行下方,再次靠近末尾

我确信您可以看到我正在尝试获取的字符串-这是我在代码中唯一剩下的字符串-“GetMeService”(它位于
[“class”]=>
中的
[3]
中)

无论我试图用(例如,
var\u dump($e=>[“trace:private”][3][“class”];
)替换我的
var\u dump
),我都无法访问该字符串。可能吗?

请参阅文档。
SoapFault类有很好的文档记录。
有很多方法。
要访问跟踪,请使用getTrace()方法

尝试:


这是因为它是私有的。感谢您提供的文档。getTrace()从
数组(8){
向下提供给我。我可以访问
[3]
数组以便以某种方式获取
['class']
object(SoapFault)#304 (8) {
  ["message:protected"]=>
  string(182) "SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://localhost:8080/examplewsdl' : failed to load external entity "http://localhost:8080/examplewsdl"
"
  ["string:private"]=>
  string(0) ""
  ["code:protected"]=>
  int(0)
  ["file:protected"]=>
  string(71) ""
  ["line:protected"]=>
  int(87)
  ["trace:private"]=>
  array(8) {
    [0]=>
    array(6) {
      ["file"]=>
      string(71) ""
      ["line"]=>
      int(87)
      ["function"]=>
      string(10) ""
      ["class"]=>
      string(10) ""
      ["type"]=>
      string(2) "->"
      ["args"]=>
      array(2) {
        [0]=>
        string(49) ""
        [1]=>
        array(6) {
          ["trace"]=>
          bool(true)
          ["features"]=>
          int(1)
          ["login"]=>
          NULL
          ["password"]=>
          NULL
          ["proxy_host"]=>
          string(13) ""
          ["proxy_port"]=>
          int(80)
        }
      }
    }
    [1]=>
    array(6) {
      ["file"]=>
      string(71) ""
      ["line"]=>
      int(41)
      ["function"]=>
      string(15) ""
      ["class"]=>
      string(18) ""
      ["type"]=>
      string(2) "->"
      ["args"]=>
      array(2) {
        [0]=>
        &object(WebServices)#292 (1) {
          ["_instanceWSCache"]=>
          array(1) {
            ["eva"]=>
            array(2) {
              ["type"]=>
              string(4) "php5"
              ["params"]=>
              array(4) {
                ["proxyhost"]=>
                string(13) ""
                ["proxyport"]=>
                int(80)
                ["wsdl"]=>
                string(49) ""
                ["uri"]=>
                string(24) ""
              }
            }
          }
        }
        [1]=>
        string(7) ""
      }
    }
    [2]=>
    array(6) {
      ["file"]=>
      string(79) ""
      ["line"]=>
      int(22)
      ["function"]=>
      string(6) ""
      ["class"]=>
      string(18) ""
      ["type"]=>
      string(2) "->"
      ["args"]=>
      array(1) {
        [0]=>
        string(7) ""
      }
    }
    [3]=>
    array(6) {
      ["file"]=>
      string(82) ""
      ["line"]=>
      int(218)
      ["function"]=>
      string(6) ""
      ["class"]=>
      string(14) "GetMeService"
      ["type"]=>
      string(2) "->"
      ["args"]=>
      array(0) {
      }
    }
  }
  ["faultstring"]=>
  string(182) "SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://localhost:8080/examplewsdl' : failed to load external entity "http://localhost:8080/examplewsdl"
"
  ["faultcode"]=>
  string(4) "WSDL"
}  
try {
  WebServices::create($this->nameWS);
}
catch (Exception $e) {                      
  $tr = $e->getTrace();
  var_dump($tr[3]);     
}