最终效果:
speedphp.com/groups-100.html // 执行 group/index,
参数
$this->spArgs(‘uid’) = 100
speedphp.com/cms-time-213.html // 执行 main/article,
参数
$this->spArgs(‘by’) = time
$this->spArgs(‘tid’) = 213
如果在配置的args中没有对应的参数名称,将按照“名-值”的方式排列接收。
speedphp.com/other-mytype-img-time-today.html // 执行other/index
参数
$this->spArgs(‘mytype’) = img
$this->spArgs(‘time’) = today
speedphp.com/groups-100-by-group.html // 执行 group/index
参数
$this->spArgs(‘tid’) = 100
$this->spArgs(‘by’) = group
另外,为了兼容部分Javascript等不能直接构造URL地址的情况,spUrlRewrite还支持原始的?&=的参数传递:
speedphp.com/groups-100-by-group.html?uid=200&view=getup // 执行 group/index
参数
$this->spArgs(‘tid’) = 100
$this->spArgs(‘by’) = group
$this->spArgs(‘uid’) = 200
$this->spArgs(‘view’) = getup
在开发中可以经常通过dump($this->spArgs());来查看全部提交的参数。
- 本文固定链接: https://db.ci/code/php/4169.html
- 转载请注明: admin 于 大博辞 发表