之外路由器參數我有這樣Phalconphp:讀控制器
$router->add("/api/:controller/:action/:params", array(
'controller' => 1,
'action' => 2,
'params' => 3,
'myParameter' => 'test'
));
所以定義的路由器,我可以得到「myParameter」參數控制器的內部這樣
$this->dispatcher->getParam("myParameter");
但是,我希望在我從Controller調用的另一個類中使用此參數。像
myCustomClass::test();
class myCustomClass {
function test() {
// this is where I need that parameter
}
}
調度員東西返回什麼,如果我把它從myCustomClass
。 (當然,獲取控制器內部的值並將它作爲一個值傳遞是一個解決方案,但我可能至少將其用於100個不同的動作,所以在這種情況下它不是一個好的解決方案)。
有沒有辦法讓額外的參數超出控制器的範圍。
試過,它返回實際的請求參數(get和post)。對於這個URL,'/ api/user/profile/1?x = y&a = b'$ request-> get()is Array([_url] =>/api/user/profile/1 [x] => a] => b) – marvin 2015-03-31 16:10:25