当前位置:首页 > PHP教程 > PHP常见问题

thinkPHP简单调用函数与类库的方法

本文实例讲述了thinkphp调用函数与类库的方法。分享给大家供大家参考,具体如下:

手册上说的很冗余,没看懂,下面简单的讲一下具体用法。

函数调用:

lib公共函数库叫 common.php

app/common/common.php

分组模块下的公共函数库叫 function.php

app/modules/admin/common/function.php

类库调用:

class indexaction extends action{ public function index(){ // 调用“扩展基类库” thinkphp/extend/library/org/util/test.class.php import('org.util.test'); $test = new test(); // 调用“扩展基类库” thinkphp/extend/library/com/util/test.class.php import('com.util.test'); $test = new test(); // 调用“核心基类库” thinkphp/lib/core/test.class.php import('think.core.test'); $test = new test(); $this->display(); } }

更多关于thinkphp相关内容感兴趣的读者可查看本站专题:《thinkphp入门教程》、《thinkphp模板操作技巧总结》、《thinkphp常用方法总结》、《codeigniter入门教程》、《ci(codeigniter)框架进阶教程》、《zend framework框架入门教程》、《smarty模板入门基础教程》及《php模板技术总结》。

希望本文所述对大家基于thinkphp框架的php程序设计有所帮助。



【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!