0

这是我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

4

1 回答 1

0

试试这个。

<?php echo $this->url('album',array('action' => 'upload_done')); ?>

url 插件采用路由的名称,在您的示例中是“album”,尽管 url 路由是“photos”

(您也可以将路线重命名为“照片”并坚持使用您原来的 url 插件示例)

于 2013-07-22T02:19:41.103 回答