我试图在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行