私は必死に ZF2 と戦ってきました。ルート ツリーを作成しようとしています。
- /manual - 手動コントローラー、index アクションに移動します
- /manual/[something] - 手動コントローラー、メーカーのアクションに移動します
- /manual/[something]/[else] - 手動コントローラ、カテゴリ アクションに移動します
- /manual/[something]/[else]/[foo] - 手動コントローラ、モデル アクションに移動します
私は公式ドキュメントと他のいくつかのウェブサイトを使用しましたが、私ができるのはトリガーだけです:
- /manual - 手動コントローラー、index アクションに移動します
- /manual/[something] - 手動コントローラ コンストラクタに移動しますが、アクションには移動しません...
他の2つはコントローラーにまったく到達しません....
'manual' => array(
'type' => 'literal',
'options' => array(
'route' => '/manual',
'defaults' => array(
'controller' => 'Applicaton\Controller\Manual',
'action' => 'index'
),
),
'may_terminate' => true,
'child_routes' => array(
// Segment route for viewing one blog post
'manufacturer' => array(
'type' => 'segment',
'options' => array(
'route' => '/[:manufacturer]',
'constraints' => array(
'manufacturer' => '[a-zA-Z0-9_-]+'
),
'defaults' => array(
'action' => 'manufacturer'
)
),
'may_terminate' => true,
'child_routes' => array(
'category' => array(
'type' => 'segment',
'options' => array(
'route' => '/[:category]',
'constraints' => array(
'category' => '[a-zA-Z0-9_-]+'
),
'defaults' => array(
'action' => 'category'
)
),
'may_terminate' => true,
'child_routes' => array(
'model' => array(
'type' => 'segment',
'options' => array(
'route' => '/[:model]',
'constraints' => array(
'model' => '[a-zA-Z0-9_-]+'
),
'defaults' => array(
'action' => 'model'
)
)
)
)
)
)
)
)
),
事前にご協力いただきありがとうございます。どんな助けでも大歓迎です!
アップデート:
これが私のコントローラーアクションです:
public function manufacturerAction() {
echo 'I am in the manufacturer action!';
return new ViewModel();
}