Domanda

I m new to cakephp, want to know how can i change url like this

C:/xyz.com/countries/view/5 to C:/xyz.com/countries/ABC

where 5 is id of ABC country

Thanks in Advance

È stato utile?

Soluzione

Router::connect('/countries/:country_id', array('controller' => 'countries', 'action' => 'view'), array('pass' => array('country_id')));

In the controller:

public function view() {
   $countryId =  $this->request->params['country_id'];
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top