本人学习的Thinkphp版本为3.1.2,为比较早的版本,是在网易云课堂上跟着赵桐正老师学习的,视频地址http://study.163.com/course/courseMain.htm?courseId=266024
本文是个人学习笔记,属于原创,转载请注明出处。
1.空操作
当用户直接在地址栏上输入不存在的方法时提供一个空方法
public function _empty($name){
$this->show("$name 不存在 <a href='__APP__/Index/index'>返回首页</a>");
}
2.空模块
当用户直接在地址栏上输入不存在的模块时提供一个空模块
新建一个EmptyController.class.php
class EmptyController extends Controller{
public function index(){
$this->show("该模块不存在")
}
}
3.前置操作和后置操作
前置操作
public function _before_方法名(){ //做判断,是否有相应的权限去执行该操作 $this->redirect("Login/index") }
后置操作
public function _after_方法名(){ //做判断,记录执行的次数 $this->redirect("Login/index") }