先跑起来一个小demo
<?php
define('APP_NAME','Hello'); //项目名称
define('APP_PATH', './Hello/'); //项目路径
define('APP_DEBUG',TRUE); //调试模式
include './ThinkPHP/ThinkPHP.php';
其中./ThinkPHP/ThinkPHP.php是think的基础配置
thinkphp框架的许多操作都通过url来实现的
http://serverName/hello.php/模块/控制器/操作/参数…
在我的这个项目中,蓝色标注的index.php是入口文件
当执行:
http://localhost/th06/th06/index.php/
http://localhost/th06/th06
时都会跳转到News下的
IndexAction中
再继续跑我的小demo
输入url:http://localhost/th06/th06/hello.php/Index
进入到hello的index模块
修改index模块代码
public function index(){
//index模块重定向到了test模块
$this->redirect('Index/test');
}
function test() {
echo "test";
$this->display();
}
执行
注意若想直接执行test模块,url:http://localhost/th06/th06/hello.php/Index/test
提示模板不存在,我们这时需要按照错误提示位置创建html文件
刷新