求助,系统的一个php数据对象,var_dump后,属性名居然是字符串类型的数字0(在线等)
帮帮看看,这个数据对象的属性怎么取?
系统的源码封闭的找不到,取出的数据,是个对象
这个对象还包含了明细对象
举例
对象A->属性a,属性b,属性c
明细属性m->明细对象1、明细对象2..
这个明细属性名m是["0"],这怎么取?试遍了方法也取不到
属性名是个string类型的0
具体var_dump输出了,红字以及下面就是明细对象
object(TDataObject)#2176 (56) {
["yjcgcgl"]=>
float(0.45)
["xmje"]=>
float(0)
["xmjd"]=>
string(12) "第一阶段"
["xmdd"]=>
string(12) "山东东营"
["xjpcID"]=>
float(12)
["xjpc3ID"]=>
float(0)
["xjpc3"]=>
object(TDataObject)#1872 (1) {
["Name"]=>
string(0) ""
}
["xjpc2ID"]=>
float(0)
["xjpc2"]=>
object(TDataObject)#1489 (1) {
["Name"]=>
string(0) ""
}
["xjpc"]=>
object(TDataObject)#1500 (1) {
["Name"]=>
string(21) "河北省电力公司"
}
["stbh"]=>
string(15) "100000000000000"
["sjystID"]=>
float(0)
["sjyst"]=>
object(TDataObject)#1392 (1) {
["Name"]=>
string(0) ""
}
["sjyID"]=>
float(24)
["sjy"]=>
object(TDataObject)#1484 (1) {
["Name"]=>
string(33) "杭州电力设计院有限公司"
}
["bjcl"]=>
string(12) "保价策略"
["TypeID"]=>
float(2024)
["Type"]=>
object(TDataObject)#1234 (1) {
["Name"]=>
string(21) "项目报备申请表"
}
["SubmitUserID"]=>
float(1)
["SubmitUser"]=>
object(TDataObject)#1413 (1) {
["Name"]=>
string(13) "administrator"
}
["SubmitTime"]=>
string(19) "2012-05-22 09:48:37"
["StartDate"]=>
string(10) "2012-05-22"
["Stage"]=>
float(0)
["Privilege2"]=>
string(0) ""
["Privilege1"]=>
string(0) ""
["Privilege"]=>
string(0) ""
["OwnerID"]=>
float(1)
["Owner"]=>
object(TDataObject)#1411 (1) {
["Name"]=>
string(13) "administrator"
}
["Name"]=>
string(9) "项目123"
["ModifiedTime"]=>
string(19) "2012-05-22 09:48:28"
["ModifiedByID"]=>
float(1)
["ModifiedBy"]=>
object(TDataObject)#1417 (1) {
["Name"]=>
string(13) "administrator"
}
["IsClosed"]=>
float(0)
["IdentifyCode"]=>
string(0) ""
["ID"]=>
float(26)
["Expense"]=>
float(0)
["EndDate"]=>
string(0) ""
["Description"]=>
string(9) "备注啊"
["DepartmentID"]=>
float(1)
["Department"]=>
object(TDataObject)#1399 (1) {
["Name"]=>
string(15) "诺雅克总部"
}
["CreatedTime"]=>
string(19) "2012-05-22 08:07:06"
["CreatedByID"]=>
float(1)
["CreatedBy"]=>
object(TDataObject)#1433 (1) {
["Name"]=>
string(13) "administrator"
}
["ClosedTime"]=>
string(0) ""
["ClosedByID"]=>
float(0)
["ClosedBy"]=>
object(TDataObject)#1431 (1) {
["Name"]=>
string(0) ""
}
["AuditStageID"]=>
float(33)
["AuditStage"]=>
object(TDataObject)#1387 (1) {
["Name"]=>
string(18) "行业经理审批"
}
["AuditFlowID"]=>
float(21)
["AuditFlow"]=>
object(TDataObject)#1391 (1) {
["Name"]=>
string(24) "项目报备审批流程"
}
["AuditFlag"]=>
float(4)
["ApprovedExpense"]=>
float(0)
["AccountID"]=>
float(37)
["Account"]=>
object(TDataObject)#1390 (1) {
["Name"]=>
string(8) "zs盘厂"
}
["_UserType"]=>
string(5) "OTHER"
["0"]=>
array(2) {
[0]=>
object(TDataObject)#2174 (13) {
["xmbbsqbID"]=>
float(26)
["xmbbsqb"]=>
object(TDataObject)#1371 (1) {
["Name"]=>
string(9) "项目123"
}
["sl"]=>
float(0)
["je"]=>
float(0)
["bj"]=>
float(0)
["TreeLevel"]=>
float(0)
["ProductID"]=>
float(10)
["Product"]=>
object(TDataObject)#2177 (6) {
["UnitID"]=>
float(1)
["Unit"]=>
object(TDataObject)#1221 (1) {
["Name"]=>
string(3) "个"
}
["StandardPrice"]=>
float(0)
["Name"]=>
string(28) "Ex9A16 4P 1600 F SU40H DC220"
["ID"]=>
float(10)
["CompoundFlag"]=>
float(0)
}
["ParentID"]=>
float(0)
["IdentifyCode"]=>
string(0) ""
["ID"]=>
float(5)
["Description"]=>
string(0) ""
["children"]=>
array(0) {
}
}
[1]=>
object(TDataObject)#1418 (13) {
["xmbbsqbID"]=>
float(26)
["xmbbsqb"]=>
object(TDataObject)#1373 (1) {
["Name"]=>
string(9) "项目123"
}
["sl"]=>
float(0)
["je"]=>
float(0)
["bj"]=>
float(0)
["TreeLevel"]=>
float(0)
["ProductID"]=>
float(19)
["Product"]=>
object(TDataObject)#1347 (6) {
["UnitID"]=>
float(1)
["Unit"]=>
object(TDataObject)#1367 (1) {
["Name"]=>
string(3) "个"
}
["StandardPrice"]=>
float(650)
["Name"]=>
string(15) "9M1S TM AC20 3P"
["ID"]=>
float(19)
["CompoundFlag"]=>
float(0)
}
["ParentID"]=>
float(0)
["IdentifyCode"]=>
string(0) ""
["ID"]=>
float(4)
["Description"]=>
string(0) ""
["children"]=>
array(0) {
}
}
}
}
[解决办法]
<?php
$obj = new stdClass();
$obj->{'0'} = 1;
$var = get_object_vars($obj)['0'];
echo $obj->{'0'} . PHP_EOL;
echo $var . PHP_EOL;
$key = 0;
echo $obj->{$key} . PHP_EOL;
?>