雷达智富

首页 > 内容 > 程序笔记 > 正文

程序笔记

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

2024-10-06 21

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

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

函数调用:

lib公共函数库叫common.php

App/common/common.php

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

App/Modules/Admin/common/function.php

类库调用:

 

 代码如下
1classIndexActionextendsAction{2  publicfunctionindex(){3   // 调用“扩展基类库” ThinkPHP/Extend/Library/ORG/Util/Test.class.php4   import('ORG.Util.Test');5   $test=newTest();6   // 调用“扩展基类库” ThinkPHP/Extend/Library/Com/Util/Test.class.php7   import('Com.Util.Test');8   $test=newTest();9   // 调用“核心基类库” ThinkPHP/Lib/Core/Test.class.php10   import('Think.Core.Test');11   $test=newTest();12   $this->display();13  }14}
更新于:12天前
赞一波!

文章评论

评论问答