在 yii 框架中
radioButtonList 和 activeRadioButtonList 有什么区别?
在 Yii 中,每个 CHtml 表单字段帮助器/小部件都有一个“常规”和“活动”版本(几乎?)。使用“活动”版本,您可以传入 ActiveRecord 模型和要为其创建表单字段的属性。这将 ActiveRecord 模型与表单字段更紧密地联系在一起,这有助于解决以下问题:
如果您正在为 ActiveRecord 模型构建表单,请使用activeRadioButtonList ,如果您正在构建常规表单(用于 CFormModel 模型),请使用 radioButtonList 。
在此处阅读有关两个版本的 radioButtonList 助手的更多信息:
radioButtonList 与模型无关 activeRadioButtonList 与模型相关