LoginSignup
2
3

More than 5 years have passed since last update.

[ZF3] Zend Framework 3 コントローラを追加する

Posted at

以下に例を記載します。

Application/
    src/
        Controller/
            IndexController.php
            TestController.php // 今回追加するコントローラ

routes にコントローラ設定を追加する。

Application/config/module.config.php
'test' => [
    'type'    => Segment::class,
    'options' => [
        'route'    => '/test[/:action]',
        'defaults' => [
            'controller' => Controller\TestController::class,
            'action'     => 'index',
        ],
    ],
],

補足

ページ別、機能が大きい場合などはモジュールを追加して分けたりする方がスマートに開発できる。

14.2. How to Create a New Module?

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3