Cake PHP redirect with parameters in url

前端 未结 4 1471
挽巷
挽巷 2020-12-24 11:57

I have a page that I want to redirect to that requires parameters in the URL: http://www.example.com/myController/myAction/param1:val1/param2:val2

I know that there

4条回答
  •  無奈伤痛
    2020-12-24 12:38

    If you need to redirect with exactly get parameters, then pass '?' index to $url array argument:

    $this->redirect(
        array(
              "controller" => "myController", 
              "action" => "myAction",
              "?" => array(
                  "param1" => "val1",
                  "param2" => "val2"
              ),
              $data_can_be_passed_here
        ),
        $status,
        $exit
    );
    

    It redirects to /myController/muAction/...?param1=val1¶m2=val2

    This is true at least in CakePHP 1.3

提交回复
热议问题