如何从下面的对象获取数组内的 Cxyabc、Cxy123 和 Cxy234?
$xml_element = simplexml_load_string($xml,null, LIBXML_NOCDATA);
$childId = $xml_element->Parent->ChildID;
print_r(childId);
SimpleXMLElement Object (
[@attributes] => Array (
[entity] => result
[order-value] => 1
)
[0] => Cxyabc
[1] => Cxy123
[2] => Cxy234
)
感谢您的回答,我尝试了以下一个并且工作正常。字符串转换是必要的。
$test = array();
foreach($childId as $value){
$strValue = (string)$value;
array_push($test,$strValue);
}