我第一次用ThinkPHP,创建了一个index.php  :
<?php
define('APP_NAME','app');
define('APP_PATH','./app/');
require 'ThinkPHP.php';
?>
然后修改了app\Lib\Action\IndexAction.class.php :
<?php
class IndexAction extends Action {
    public function index(){
$this->display();
    }
}
可以在网站中打开index.php ,可以调用\Tpl\index\index.html.现在我想再建个user.php ,最终像index.php 那样,调用\Tpl\index\user.html,请问修改哪些代码?谢谢!

解决方案 »

  1.   

    index.php是入口文件,只有一个,不用再建立user.php
    只需要修改app\Lib\Action\IndexAction.class.php :
    <?php
    class IndexAction extends Action {
        public function index(){
    $this->display();
        }    public function user(){
            $this->display();
        }
    }访问时用index.php/Index/user这样的路径
      

  2.   

    只需要在IndexController.class.php方法里,再新建一个方法:
    public function user(){
      $this->display();
    }
    最后在View/default/Index/新建一个user.html的文件。
    3.2版本一下的thinkphp的view层可能和上面说的不一样,可以参考手册
      

  3.   

    也可以直接修改这个
    $this->display();
      

  4.   

    也可以直接修改这个
    $this->display();