我如何获得所有atrribute标签在警予1
问题描述:
有品牌表(它包含brand_id,BRAND_NAME,b_year)和验证码我如何获得所有atrribute标签在警予1
`Products::model()->getAttributeLabel('brand_id')`
var_dump(Products::model()->getAttributeLabel('brand_id'));
它只显示brand_id标签。我如何显示所有标签而不是一个?
答
试试这个
var_dump(Products::model()->attributeLabels());
答
斐伊川attributeLabels()
是Model
一个function
。它返回一个array
与database
领域为重点。
,让你不得不只是没有agruments这样称呼它
var_dump(Products::model()->attributeLabels()); // this will return complete array
凡为getAttributeLabel
是写在CActiveRecord
的所有标签,并期待和定义的参数也不会给出所有领域lablels
答
请试试这个,
$lables = Products::model()->attributeLabels();
print_r($labels);
$lables
回报所有标签从Products
MOD埃尔。