比如我现在在yii框架中访问名叫List控制器(Controller)的index动作(action)且参数为 big_class等于1 则为: http://www.test.com/index.php?r=list/index&big_class=1,如果翻页的话会是http://www.test.com/index.php?r=list/index&big_class=1&page=1,2,3,4……
那么接下来我在main.php 中定义rewrite规则,在components大数组中加入
'urlManager' => array(
'urlFormat' => 'path',
'rules' => array(
'<controller:\w+>/<action:\w+>/<page:\d+>' => '<controller>/<action>/<page>',
),
),
这样再次访问以上链接时就会变为:
http://www.test.com/list/index/big_class/1 且列表翻页后会是 http://www.test.com/list/index/big_class/1/page/1 http://www.test.com/list/index/big_class/1/page/2 ……
这样就达到了伪静态的效果,可以不出现?或者&符号等参数了