author:咔咔
wechat:fangkangfk
超类:
是PHP的一个特殊类
超类就是定义了一些通用的方法,在其余类中不须要继承就能够直接使用的超类的方法,而是经过use引入的类,至关于include这样理解
在框架中使用的这几个方法其实都是属于超类里边的方法php
$this->success($msg,$url); $this->error($msg,$url); $this->result($data,$code,$msg,$type); $this->redirect($url,$param);
超类对应的提示模板位置框架
超类的位置this
超类的用法:url
/** * 用法: * class index * { * use \traits\controller\Jump; * public function index(){ * $this->error(); * $this->redirect(); * } * } */
案例:spa
就拿咱们的controller这个类来讲引入的Jump这个超类,咱们才能够在控制器使用文章开头的那四个方法的code