Zend framework2 将片段id添加到Zend重定向

Zend framework2 将片段id添加到Zend重定向,zend-framework2,Zend Framework2,也许我傻了,找不到文件。我想在控制器操作重定向中使用的URL的末尾添加一个片段id。这就是我想做的: return $this->redirect()->toRoute('jobapplication',array('action'=>'edit','id'=>$candidateclass->application_id,'fragment'=>'candidateclass')); 我得到的只是: http://localhost/Zend/public

也许我傻了,找不到文件。我想在控制器操作重定向中使用的URL的末尾添加一个片段id。这就是我想做的:

return $this->redirect()->toRoute('jobapplication',array('action'=>'edit','id'=>$candidateclass->application_id,'fragment'=>'candidateclass'));
我得到的只是:

http://localhost/Zend/public/jobapplication/edit/21
我想要这个:

http://localhost/Zend/public/jobapplication/edit/21#candidateclass

想法?

如果在
$options
数组中传递片段,这是
toRoute()
方法的第三个参数,请尝试

return $this->redirect()->toRoute(
    'jobapplication', 
    array('action' => 'edit', 'id' => $candidateclass->application_id), 
    array('fragment' => 'candidateclass')
);

使用字符串连接?:-)肮脏,但很好。太棒了!试过了,效果很好。我一直在拼命寻找有关它的文件。谢谢