首先,请原谅我的低级英语。
在名为webController的控制器中执行以下操作:
public function actionPage($view = 'index')
{
try {
return $this->render('site/page/' . $view);
} catch (InvalidParamException $e) {
throw new HttpException(404);
}
}
我需要一条规则来执行以下操作:
localhost/cookies
equals
localhost/?r=web/page&view=cookiesyprivacidad
或
localhost/faq
equals
localhost/?r=web/page&view=preguntas
这样的事情:
'rules'=>array(
'cookies'=>'web/page'
)
但添加固定参数。
答案 0 :(得分:0)
'rules'=>array(
'cookies'=>'page/cookiesyprivacidad',
'faq'=>'page/preguntas',
)
public function actionCookiesyprivacidad()
{
try {
return $this->render('site/page/cookiesyprivacidad');
} catch (InvalidParamException $e) {
throw new HttpException(404);
}
}
public function actionPreguntas()
{
try {
return $this->render('site/page/preguntas');
} catch (InvalidParamException $e) {
throw new HttpException(404);
}
}
答案 1 :(得分:0)
你需要这个
'urlManager' => array(
'rules' => array(
<view:(cookies|faq)>' => 'web/page'
)
)