求助啊,从一个对象中取值. [ 新手入门 ]
问题已解决. 直接$a->name就可以的. 之间之所以有问题,是因为findbysql 默认显示一条.我循环了一下. 如果需要多条.需要用findAllBySql来执行. 5/22/2011
AppSys Object
(
[_attributes:CActiveRecord:private] => Array
(
[id] => 2
[name] => 企业招聘
[name_en] => recruiter
[is_audit] => 1
)
)
这种怎么获取啊
foreach ($nohaveapps as $a) { ?><?= $a->name ?><? }?>
取不到值... 代码在下楼.
共 1 条回复
-
AppSys Object ( [_md:CActiveRecord:private] => CActiveRecordMetaData Object ( [tableSchema] => CMysqlTableSchema Object ( [schemaName] => [name] => g_app_sys [rawName] => `g_app_sys` [primaryKey] => id [sequenceName] => [foreignKeys] => Array ( ) [columns] => Array ( [id] => CMysqlColumnSchema Object ( [name] => id [rawName] => `id` [allowNull] => [dbType] => int(11) [type] => integer [defaultValue] => [size] => 11 [precision] => 11 [scale] => [isPrimaryKey] => 1 [isForeignKey] => [autoIncrement] => 1 [_e:CComponent:private] => [_m:CComponent:private] => ) [name] => CMysqlColumnSchema Object ( [name] => name [rawName] => `name` [allowNull] => [dbType] => varchar(255) [type] => string [defaultValue] => [size] => 255 [precision] => 255 [scale] => [isPrimaryKey] => [isForeignKey] => [autoIncrement] => [_e:CComponent:private] => [_m:CComponent:private] => ) [name_en] => CMysqlColumnSchema Object ( [name] => name_en [rawName] => `name_en` [allowNull] => [dbType] => varchar(255) [type] => string [defaultValue] => [size] => 255 [precision] => 255 [scale] => [isPrimaryKey] => [isForeignKey] => [autoIncrement] => [_e:CComponent:private] => [_m:CComponent:private] => ) [is_audit] => CMysqlColumnSchema Object ( [name] => is_audit [rawName] => `is_audit` [allowNull] => [dbType] => tinyint(4) [type] => integer [defaultValue] => 0 [size] => 4 [precision] => 4 [scale] => [isPrimaryKey] => [isForeignKey] => [autoIncrement] => [_e:CComponent:private] => [_m:CComponent:private] => ) ) [_e:CComponent:private] => [_m:CComponent:private] => ) [columns] => Array ( [id] => CMysqlColumnSchema Object ( [name] => id [rawName] => `id` [allowNull] => [dbType] => int(11) [type] => integer ... [scale] => [isPrimaryKey] => 1 [isForeignKey] => [autoIncrement] => 1 [_e:CComponent:private] => [_m:CComponent:private] => ) [name] => CMysqlColumnSchema Object ( [name] => name [rawName] => `name` ... [scale] => [isPrimaryKey] => [isForeignKey] => [autoIncrement] => [_e:CComponent:private] => [_m:CComponent:private] => ) [name_en] => CMysqlColumnSchema Object ( [name] => name_en [rawName] => `name_en` [allowNull] => [dbType] => varchar(255) [type] => string [defaultValue] => [size] => 255 [precision] => 255 [scale] => [isPrimaryKey] => [isForeignKey] => [autoIncrement] => [_e:CComponent:private] => [_m:CComponent:private] => ) [is_audit] => CMysqlColumnSchema Object ( [name] => is_audit ... [_e:CComponent:private] => [_m:CComponent:private] => ) ) [relations] => Array ( [userAppRoles] => CHasManyRelation Object ( [limit] => -1 [offset] => -1 [index] => [through] => [joinType] => LEFT OUTER JOIN [on] => [alias] => [with] => Array ( ) [together] => [name] => userAppRoles [className] => UserAppRole [foreignKey] => app_id [select] => * [condition] => [params] => Array ( ) [group] => [join] => [having] => [order] => [_e:CComponent:private] => [_m:CComponent:private] => ) ) [_model:CActiveRecordMetaData:private] => AppSys Object ( [_md:CActiveRecord:private] => CActiveRecordMetaData Object *RECURSION* [_new:CActiveRecord:private] => [_attributes:CActiveRecord:private] => Array ( ) [_related:CActiveRecord:private] => Array ( ) [_c:CActiveRecord:private] => [_pk:CActiveRecord:private] => [_alias:CActiveRecord:private] => t [_errors:CModel:private] => Array ( ) [_validators:CModel:private] => [_scenario:CModel:private] => [_e:CComponent:private] => [_m:CComponent:private] => ) ) [_new:CActiveRecord:private] => [_attributes:CActiveRecord:private] => Array ( [id] => 2 [name] => 企业招聘 [name_en] => recruiter [is_audit] => 1 ) [_related:CActiveRecord:private] => Array ( ) [_c:CActiveRecord:private] => [_pk:CActiveRecord:private] => 2 [_alias:CActiveRecord:private] => t [_errors:CModel:private] => Array ( ) [_validators:CModel:private] => [_scenario:CModel:private] => update [_e:CComponent:private] => [_m:CComponent:private] => )
caridy
注册时间:2011-05-19
最后登录:2022-07-01
在线时长:3小时53分
最后登录:2022-07-01
在线时长:3小时53分
- 粉丝6
- 金钱480
- 威望0
- 积分510