Home >Backend Development >PHP Tutorial >ThinkPHP sample code for simply calling functions and class library methods
This article mainly introduces how thinkPHP simply calls function and class library. It briefly describes the file location of thinkPHP's public function library and analyzes the calling of the class library with examples. Methods, friends in need can refer to
This article describes the method of calling functions and class libraries in thinkPHP. I would like to share it with you for your reference. The details are as follows:
The manual is very redundant and I don’t understand it. Let’s briefly explain the specific usage.
Function call:
lib public function library is called common.php
App/common/common. php
The public function library under the group module is called function.php
App/Modules/Admin/common/function.php
Class library call:
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(); } }
Related articles:
ThinkPHP3.2 framework uses addAll() to batch insert data. Share
thinkPHP database addition, deletion, modification and query operation method detailed explanation
The above is the detailed content of ThinkPHP sample code for simply calling functions and class library methods. For more information, please follow other related articles on the PHP Chinese website!