我第一次用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,请问修改哪些代码?谢谢!
<?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,请问修改哪些代码?谢谢!
解决方案 »
- js 弹窗出现乱码了
- 采集时发现我模拟登录时取的id值是变化的?
- 寻找jakey9826(无眠)!急盼解决问题!
- 我的php环境不支持../请问应该怎么办,我的是php526
- PHP怎么获取路径
- 求最最最经典的MySql类、分页类、图片上传类!
- 再问 sockest 如何 post 数据,请给详细代码
- ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffasdfdfdfdfdfd
- 怎么调试php代码,简单点的方法,如print,echo,行吗?
- PHP数组循环问题
- 新手。我该怎么写呢?判断语句。大神们帮帮忙~
- PHP网站已经做了伪静态,设置了路由规则,如何做301重定向呢
只需要修改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这样的路径
public function user(){
$this->display();
}
最后在View/default/Index/新建一个user.html的文件。
3.2版本一下的thinkphp的view层可能和上面说的不一样,可以参考手册
$this->display();
$this->display();