欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2024-03-08 09:14:39
本文实例讲述了thinkphp调用函数与类库的方法。分享给大家供大家参考,具体如下: 手册上说的很冗余,没看懂,下面简单的讲一下具体用法。 函数调用: lib公共函数...

本文实例讲述了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程序设计有所帮助。