【Thinkphp5】如何引⼊extend拓展⽂件
extend/maile/cc.php ⽂件⽬录cc⽂件 必须要加上命名空间,如下cc.php⽂件内容如下:
1 namespace maile; //命名空间 maile是⽂件夹名称2 class Cc { //类名
3 public function ac(){4 echo \"chengjing\";5 }6 }
控制器中试⽤
1 use maile\\cc; //引⽤ maile⽂件夹下的cc.php⽂件2
3 public function index()4 {
5 $b=new Cc();
6 echo $b->ac(); // 输出 chengjing7 }