ITPub博客

首页 > IT职业 > IT职场 > php 自定义扩展类方法

php 自定义扩展类方法

IT职场 作者:leviyang 时间:2021-09-09 09:22:22 0 删除 编辑

Thinkphp 自定义扩展类

1、编写类

class My {

public function abc(){

echo 'My->abc()....';

}

}


2、把类放在thinkphp目录下的Libray/ORG/Util/My.class.php 中


3. 在程序中直接使用

class IndexAction extends Action {

public function index() {

import('ORG.Util.My');// 导入类

$my = new My();

$my->abc();

$this->display ();

}

}


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/2880/viewspace-2802757/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-08-19

  • 博文量
    77
  • 访问量
    641