我喜欢做的是创建一个完整的网址。
Controller = 'A'
Action = 'doSomething'
param1 = $id
param2 = $id2
我目前得到的是: mydomain.com/A/doSomething?param1=X¶m2=XX
我想要的是: mydomain.com/A/doSomething/X/XX
代码:
$message = 'Test: '. Router::url([
"controller" => "A",
"action" => "doSomthing",
"param1" => $id,
"param2" => $id2,
'_full' => true
]);
答案 0 :(得分:2)
$id1 = 'id1';
$id2 = 'id2';
$url= Router::url([
"controller" => "A",
"action" => "doSomething",
$id1,
$id2,
'_full' => true
]);
debug($url);
输出:
' http://host/a/do-something/id1/id2'
答案 1 :(得分:0)
尝试:
public function doSomthing($param1, $param2)
{
#your code here
}