1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

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';
1
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?