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

6年以前  |  阅读数:1002 次  |  编程语言:PHP 

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

Copyright© 2013-2020

All Rights Reserved 京ICP备2023019179号-8