首页 > IT职业 > IT职场 > php 自定义扩展类方法
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/ ,如需转载,请注明出处,否则将追究法律责任。