私は zend フレームワーク 2 を初めて使用し、アルバム モジュールを ZF2 のスケルトン アプリケーションに追加しようとしましたが、404 エラーが発生しました ページが見つかりません。要求された URL はルーティングによって一致しませんでした。私の Album/config/module.config.php コードは
<?php
return array(
'controllers' => array(
'invokables' => array(
'Album\Controller\Album' => 'Album\Controller\AlbumController',
),
),
'view_manager' => array(
'template_path_stack' => array(
'album' => __DIR__ . '/../view'
),
),
'router' => array(
'routes' => array(
'album' => array(
//'type' => 'segment',
'type' => 'Zend\Mvc\Router\Http\Literal',
'options' => array(
//'route' => '/album[/][:action][/:id]',
//'route' => '/:controller[.:formatter][/:id]',
'route' => '/album',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'formatter' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]+',
),
'defaults' => array(
'__NAMESPACE__' => 'Album\Controller',
'controller' => 'Album\Controller\Album',
'action' => 'index',
),
),
),
),
),
);
Application/config/module.config.php に次の行を追加しました。
'modules' => array(
'Application',
'Album'
),
'module_listener_options' => array(
'config_glob_paths' => array(
'config/autoload/{,*.}{global,local}.php',
),
'module_paths' => array(
'./module',
'./vendor',
),
),
誰でもコードを修正するのを手伝ってもらえますか...