thinkphp323Note - juedaiyuer/researchNote GitHub Wiki

#ThinkPHP3.2.3快速入门阅读笔记#

##添加新的模块##

#入口文件定义
define('APP_PATH','./Application/');
#绑定入口文件到Admin模块访问
define('BIND_MODULE','Admin');
require './ThinkPHP/ThinkPHP.php';

##更改应用目录##

// 定义应用目录
define('APP_PATH','./Apps/');
// 定义运行时目录
define('RUNTIME_PATH','./Runtime/');
// 更名框架目录名称,并载入框架入口文件
require './Think/ThinkPHP.php';

##调试模式##

##配置##

##控制器##

需要为每个控制器定义一个控制器类

控制器类的命名规范是:
控制器名+Controller.class.php (模块名采用驼峰法并且首字母大写)

系统的默认控制器是Index

#Controller/IndexController.class.php
#添加操作方法hello
public function hello ($name='thinkphp'){
    echo 'hello ' .$name.'!';
}

##URL请求##

###普通模式###

#普通模式URL
...index.php?m=home&c=index&a=hello&name=judaiyuer

#等效于
#默认模块,默认控制器
?a=hello&name=juedaiyuer

###PATHINFO模式###

...index.php/模块/控制器/操作

#也可以用普通模式的参数方式传入参数
...index.php/home/index/hello?name=juedaiyuer

##视图##

##source##

  • ThinkPHP3.2.3快速入门.pdf