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} |
赞一波!
相关文章
- 【说站】python函数符号sympy的用法
- 【说站】python中str()函数转换字符串
- 【说站】Python找回文子串的方法
- 【说站】php数组合并的方法
- 【说站】python json保存数据的方法
- 【说站】python编写函数的注意点
- 【说站】python函数中返回值的作用
- 【说站】python在函数中传递实参
- 【说站】python函数如何指定默认值
- 【说站】python如何用函数删除空白
- 【说站】python字符串如何简单运算
- 【说站】python处理数字列表的函数
- 【说站】python列表中有哪些内置函数
- 【说站】python系统内置方法如何获取
- 【说站】python random中的随机函数
- 【说站】python匿名函数的好处
- 【说站】python匿名函数lambda的注意点
- 【说站】python函数式编程如何理解
- 【说站】java反射三种方法
- 【说站】python字符串格式化的方法整理
文章评论
评论问答