+ -
当前位置:首页 → 问答吧 → TP2.1路由求助

TP2.1路由求助

时间:2011-11-14

来源:互联网

RT:例如我的分页是admin.php/Member?keyword=&p=1
怎样点击下一页后url地址栏显示的是 admin.php/Member/index/p/1
已开启'URL_ROUTER_ON'=>true,
官网的demo
  1. <?php

  2. return array(
  3.     'URL_ROUTER_ON'=>true,
  4. );
  5. ?>

  6. 路由定义文件routes.php
  7. <?php
  8. return array(
  9.     array('Category','Blog/category','id'),
  10.     array('/^Blog\/(\d+)$/is','Blog/read','id'),
  11.     array('/^Blog\/(\d+)\/(\d+)/is','Blog/archive','year,month'),
  12. );

  13. ?>

  14. 控制器IndexAction类
  15. <?php
  16. class IndexAction extends Action{

  17.     public function index()
  18.     {
  19.         $this->assign('vars',!empty($_GET)?$_GET:'');

  20.         $this->display('Index:index');

  21.     }
  22. }
  23. ?>

  24. 控制器BlogAction类
  25. <?php
  26. class BlogAction extends Action{

  27.     public function category() {
  28.         $this->assign('vars',!empty($_GET)?$_GET:'');

  29.         $this->display('Index:index');

  30.     }
  31.     public function archive() {

  32.         $this->assign('vars',!empty($_GET)?$_GET:'');

  33.         $this->display('Index:index');

  34.     }
  35.     public function read(){

  36.         $this->assign('vars',!empty($_GET)?$_GET:'');

  37.         $this->display('Index:index');

  38.     }
  39. }
  40. ?>
复制代码
没搞明白、越看越晕、

作者: AK^47   发布时间: 2011-11-14

看看 兄弟讲的视频

作者: lsttf   发布时间: 2011-11-14

lsttf 额、这就去

作者: AK^47   发布时间: 2011-11-14