路由在ZF3中获取数据

时间:2018-08-03 13:54:35

标签: zend-framework3

我试图在zf3中设置路由。但是Zend \ Router \ Http \ Method不适用于child_routes;

如果我使用Zend \ Router \ Http \ Segment或Zend \ Router \ Http \ Literal,一切正常。     

namespace Api\User;

use Zend\Router\Http\Method;

return [
    'router' => [
        'routes' => [
            'users' => [
                'type' => Method::class,
                'options' => [
                    'verb' => 'get',
                    'route'    => '/users',
                    'defaults' => [
                        'controller' => Controller\UserController::class,
                        'action'     => 'index',
                    ],
                ],
                'may_terminate' => true,
                'child_routes' => [
                    'user' => [
                        'type' => Method::class,
                        'options' => [
                            'verb' => 'get',
                            'route'    => '/:id/user',
                            'defaults' => [
                                'controller' => Controller\UserController::class,
                                'action'     => 'user',
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],
    'view_manager' => array(
        'strategies' => array(
            'ViewJsonStrategy',
        ),
    ),
];

问题:

  • 我想念什么?
  • 如果是,那么配置看起来如何?

错误: 警告:include(/var/www/backoffice.armacad.info/module/Api/Main/config /../ view / layout / layout.phtml):无法打开流:/ var / www中没有此类文件或目录/backoffice.armacad.info/vendor/zendframework/zend-view/src/Renderer/PhpRenderer.php在第502行

0 个答案:

没有答案