我是cakephp的新手,想知道如何更改这样的网址
C:/xyz.com/countries/view/5到C:/xyz.com/countries/ABC
其中5是ABC国家的ID
先谢谢
答案 0 :(得分:1)
Router::connect('/countries/:country_id', array('controller' => 'countries', 'action' => 'view'), array('pass' => array('country_id')));
在控制器中:
public function view() {
$countryId = $this->request->params['country_id'];
}