1
在symfony中,我可以使用哪種方法在我的路由上進行反向查找以確定URL指向的模塊和操作?有沒有一種方法來獲取URL引用的模塊/操作?
說,是這樣的:
get_module("http://host/cars/list"); // ("cars")
get_action("http://host/frontend_dev.php/cars/list"); // ("list")
請記住,我不想進行簡單的字符串黑客這樣做,因爲有可能是不太那麼明顯的映射:
get_module("/"); // (What this returns is entirely dependent on the configured routes.)
謝謝!
在freenode的#symfony中,我注意到symfony在滿足請求時已經基本做到了這一點!看起來好像沒有最好的實踐方式來自己獲取這些信息。也許像$ context-> getRouting() - >匹配('url')? – 2011-05-25 22:51:05
我已就此問題打開以下票證:http://trac.symfony-project.org/ticket/9800 – 2011-05-25 23:06:30