好的,看看这个伏都教:
此代码:
$xml = new SimpleXMLElement($xml);
$var = $xml->QBXMLMsgsRs->ClassQueryRs;
$vars = print_r($var,true);
返回:
SimpleXMLElement Object
(
[@attributes] => Array
(
[requestID] => Q2xhc3NRdWVyeXw1
[statusCode] => 0
[statusSeverity] => Info
[statusMessage] => Status OK
)
[ClassRet] => Array
(
[0] => SimpleXMLElement Object
(
[ListID] => 80000002-1241128424
[TimeCreated] => 2009-04-30T17:53:44-05:00
[TimeModified] => 2009-04-30T17:53:44-05:00
[EditSequence] => 1241128424
[Name] => D1
[FullName] => D1
[IsActive] => true
[Sublevel] => 0
)
[1] => SimpleXMLElement Object
(
[ListID] => 80000001-1241128320
[TimeCreated] => 2009-04-30T17:52:00-05:00
[TimeModified] => 2009-04-30T17:52:00-05:00
[EditSequence] => 1241128320
[Name] => K1
[FullName] => K1
[IsActive] => true
[Sublevel] => 0
)
[2] => SimpleXMLElement Object
(
[ListID] => 80000003-1241128452
[TimeCreated] => 2009-04-30T17:54:12-05:00
[TimeModified] => 2009-04-30T17:54:12-05:00
[EditSequence] => 1241128452
[Name] => S1
[FullName] => S1
[IsActive] => true
[Sublevel] => 0
)
)
)
但是,这段代码:
$xml = new SimpleXMLElement($xml);
$var = $xml->QBXMLMsgsRs->ClassQueryRs->ClassRet;
$vars = print_r($var,true);
返回:
SimpleXMLElement Object
(
[ListID] => 80000002-1241128424
[TimeCreated] => 2009-04-30T17:53:44-05:00
[TimeModified] => 2009-04-30T17:53:44-05:00
[EditSequence] => 1241128424
[Name] => D1
[FullName] => D1
[IsActive] => true
[Sublevel] => 0
)
对于我的生活,我无法访问这个对象的其余部分! Echo,print_r ....如果我尝试访问特定变量,它就会消失!