Zend framework 如何在zend控制器的操作中获取selectbox值名称

Zend framework 如何在zend控制器的操作中获取selectbox值名称,zend-framework,zend-form,Zend Framework,Zend Form,我有一个zend表单中的选择框,它是从数据库中填充的 $topics = Doctrine_Core::getTable('Model_Topic')->findAll(); $topic = new Zend_Form_Element_Select('topic'); $topic->setLabel('Topic')->setRequired(true); foreach($topics as $topics1) { $topic->addMultiOptio

我有一个zend表单中的选择框,它是从数据库中填充的

$topics = Doctrine_Core::getTable('Model_Topic')->findAll();
$topic = new Zend_Form_Element_Select('topic');
$topic->setLabel('Topic')->setRequired(true);

foreach($topics as $topics1) {
   $topic->addMultiOption($topics1->id, $topics1->title);
}
在操作中,我可以获得类似
$topic=$form->getValue('topic')的值这将为我提供ID,但如何获取该ID的名称?

您可以通过获取整个多选项集并通过数组键选择所选选项来获取选项“值”(如文本值)

$topic = $form->getValue('topic');
$options = $form->topic->getMultiOptions();
$topicTitle = $options[$topic];

您已经成为会员两年多了。我真的很难相信你仍然不知道如何格式化你的帖子。我很少使用这个论坛。。。你能告诉我怎么接受这个答案吗。。我看不到任何接受答案的选择