LoginSignup
16
20

More than 5 years have passed since last update.

【CakePHP】リダイレクト

Last updated at Posted at 2014-01-16

リダイレクト先の設定方法をまとめる。
リダイレクト後にexit()が発行されるため、処理が終了する。

コントローラとアクションとパラメータを指定

コントローラとアクションとパラメータを指定
// リダイレクト先:/orders/confirm/7
$this->redirect(['controller'=>'orders','action'=>'confirm',7]);

URL指定

URL指定
// リダイレクト先: http://example/orders/confirm
$this->redirect('http://example/orders/confirm');

絶対パス

絶対パス
// リダイレクト先: /orders/confirm
$this->redirect('/orders/confirm');
16
20
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
16
20