我正在尝试填充一个选择列表(Zend_Form_Element_Select
),并且我尝试了这两个数组。(这些是 var 转储)
这个有效:
array(2) {
[0] => array(2) {
["key"] => int(1)
["value"] => string(4) "Test"
}
[1] => array(2) {
["key"] => int(2)
["value"] => string(5) "Test2"
}
这个没有:
array(3) {
[0] => array(2) {
["key"] => int(1)
["value"] => string(16) "Test Kategorie 1"
}
[1] => array(2) {
["key"] => int(2)
["value"] => string(16) "Test Kategorie 2"
}
[2] => array(2) {
["key"] => int(3)
["value"] => string(4) "rene"
}
}
这是我的代码片段:
$select = new Zend_Form_Element_Select('video_category', array(
'required' => true,
'label' => 'label_video_category',
//'multioptions' => $this->categories,
'description' => 'text_video_category',
'class' => 'input',
'id' => 'select_video_category'
));
$options = array(
array( 'key' => 1,
'value' => 'Test'),
array( 'key' => 2,
'value' => 'Test2'),
);
Zend_Debug::dump($options);
$select->addMultioptions($this->categories);
$this->addElement($select);
因此,如果有人对我有任何线索,我将非常感激,因为我已经坚持了几个小时......