【发布时间】:2010-11-30 20:13:13
【问题描述】:
我有这个 SimpleXML 对象:
object(SimpleXMLElement)#176 (1) {
["record"]=>
array(2) {
[0]=>
object(SimpleXMLElement)#39 (2) {
["f"]=>
array(2) {
[0]=>
string(13) "stuff"
[1]=>
string(1) "1"
}
}
[1]=>
object(SimpleXMLElement)#37 (2) {
["f"]=>
array(2) {
[0]=>
string(13) "more stuff"
[1]=>
string(3) "90"
}
}
}
为什么 is_array($object->record) 返回 false?它清楚地表明它是一个数组。为什么我用 is_array 检测不到?
另外,我无法使用 (array) $object->record 将其转换为数组。我收到此错误:
警告:目前还不能 将复杂类型分配给属性
【问题讨论】:
-
永远不要相信
var_dump()或print_r()与 SimpleXML。