一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

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

时间:2017-06-28 编辑:简简单单 来源:一聚教程网

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

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

函数调用:

lib公共函数库叫common.php

App/common/common.php

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

App/Modules/Admin/common/function.php

类库调用:

 

 代码如下复制代码

classIndexActionextendsAction{

  publicfunctionindex(){

   // 调用“扩展基类库” ThinkPHP/Extend/Library/ORG/Util/Test.class.php

   import('ORG.Util.Test');

   $test=newTest();

   // 调用“扩展基类库” ThinkPHP/Extend/Library/Com/Util/Test.class.php

   import('Com.Util.Test');

   $test=newTest();

   // 调用“核心基类库” ThinkPHP/Lib/Core/Test.class.php

   import('Think.Core.Test');

   $test=newTest();

   $this->display();

  }

}

 

热门栏目