LoginSignup
0
0

More than 3 years have passed since last update.

CakePHPのルーティング

Posted at

ルーティングまとめ

デフォルトルーティング

デフォルトルートの URL パターン:
http://example.com/controller/action/param1/param2/param3

(例)

URL: /monkeys/jump
Mapping: MonkeysController->jump();

URL: /products
Mapping: ProductsController->index();

URL: /tasks/view/45
Mapping: TasksController->view(45);

URL: /donations/view/recent/2001
Mapping: DonationsController->view('recent','2001');

名前付きパラメーター

URL: /contents/view/chapter:models/sections:assosiations
Mapping: ContentsController->view();

コントローラでの受け取り

$this->passedArgs['chapter'] = 'models';
$this->passedArgs['sections'] = 'associations';

または

$this->params['named']['chapter'] = 'models';
$this->paramas['named']['section'] = 'associations';
0
0
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
0
0