参考にさせて頂いたページ
名前付きでパラメータを受け取る方法 - Writing Some Code
引数
例えば下記のようなURLでページにアクセスすると
https://hoge.com/controllers/index/hoge/foo
以下のような感じで、indexアクションで'hoge'と'foo'が引数として受け取れる。
要するにURLの、actionのあとにスラッシュ区切りで引数が渡せる。
public function index($variable1, $variable2){ echo $variable1;//hoge echo $variable2;//foo }
名前付きパラメーター
例えば下記のようなURLでページにアクセスすると
https://hoge.com/articles/index/param1:hoge/param2:foo
以下のような感じで、それぞれ使用できる。
public function index(){ echo $this->params['named']['param1'];//hoge echo $this->params['named']['param2'];//foo }