下面是我的module.config
页面的代码
'router' => array(
'routes' => array(
'album' => array(
'type' => 'segment',
'options' => array(
'route' => '/photos[/:action][/:id]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]+',
),
'defaults' => array(
'controller' => 'Photos'Controller'Photos',
'action' => 'index',
),
),
),
),
),
在我的控制器页面
public function uploadAction()
{
//die('uploading page');
$this->layout('layout/index');
return array();
}
die works fine
我的首页代码是
这是我试图链接到任何其他页面的页面。。。。。
`<?php echo $this->url('photos',array('action' => 'upload_done')); ?>`
我得到一个错误
Fatal error: Uncaught exception 'Zend'Mvc'Router'Exception'RuntimeException' with message 'Route with name "photos" not found' in
试试这个。
<?php echo $this->url('album',array('action' => 'upload_done')); ?>
url插件采用路由的名称,在您的示例中,它是"相册",尽管url路由是"照片"
(你也可以将路线重命名为"照片",并使用你原来的url插件示例)