Skeleton Application and Module を使用して基本的な Zend Framework 2 アプリケーションを作成しましたが、ルーティングの問題が発生し、回避できないようです。
Zend Framework Web サイトの新しい Quickstart モジュールに大まかに基づいている私のモジュール内では、module.config.php 内に次のルートがあります。
'router' => array(
'routes' => array(
'blog' => array(
'type' => 'Literal',
'options' => array(
// Change this to something specific to your module
'route' => '/blog',
'defaults' => array(
// Change this value to reflect the namespace in which
// the controllers for your module are found
'__NAMESPACE__' => 'Blog\Controller',
'controller' => 'View',
'action' => 'index',
),
),
'may_terminate' => true,
'child_routes' => array(
// This route is a sane default when developing a module;
// as you solidify the routes for your module, however,
// you may want to remove it and replace it with more
// specific routes.
'default' => array(
'type' => 'Segment',
'options' => array(
'route' => '[/:controller[/:action]]',
'constraints' => array(
'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' => array(
),
),
),
),
),
),
),
このルートは、標準モジュール、コントローラー、およびアクション URL 要求を使用する場合に正常に機能するように見えます。
blah.com/blog/post/view
私が問題を抱えているのは、URL 経由でデータを渡そうとしたときです。
blah.com/blog/post/view/id/1
2 つの URL のうち後者は 404 になります。私は、データが URL で渡されることを許可するために子ルートが必要だと推測していますが、私が必要とするものに正確にこだわっています。誰かが私を正しい方向に向けることができますか? 一線を越えないように見えますが、リファレンスガイドを閲覧しました。
どんな助けでも感謝します。