routing あれこれ
/config/routes.php
- routes.php
<?php $routes->connect //ルート プレースホルダー(:)URL部分のバリデーションができる ('/student/qaaQuestion/:question_num/:count', //コントローラーとアクションの指定 ['controller' =>'Login', 'action' => 'index']); //バリデーションの指定 question_num は数字のみ受付 countは3桁までの数字のみを受け付ける ['question_num' => '\d+','count' => '\d{1,3}'] ); ?>
- qaa_select_genre.ctp
<?php //フォーム生成時点でプレースホルダー部分の値を指定する echo $this-> Form -> create('', ['type' => 'post', 'url' => ['action' => 'qaaQuestion','question_num' => 1,'count' => 0 ]]); ?>