This article mainly introduces several usages of import in thinkphp, the need for friends can refer to the followingHere are a few usages of import
1. Usage One
Import (' @. Test.translate ');
@, which represents the project root directory. Assume that the root directory is: app/
The path to the Import class library is: app/lib/test/translate.class.php
Conclusion:import (' @ ') is relative to the Lib directory of the project directory
2. Usage Two
Import (' Think.Test.Translate ');
A Think that represents the system root directory. Both:./thinkphp/
The path to the Import class library is:./thinkphp/lib/test/translate.class.php
Conclusion:import (' Think ') is relative to the Lib directory of the system directory
3. Usage Three
Import (' ORG. Test.translate ');
Or
Import (' COM. Test.translate ');
ORG, third-party public class Library directory
COM, Enterprise public class Library Directory
Both of these are written in relation to./thinkphp/extend/library/.
The path to the Import class library is:./thinkphp/extend/library/org/test/translate.class.php
Or
The path to the Import class library is:./thinkphp/extend/library/com/test/translate.class.php
Conclusion:import (' ORG ') or import (' COM ') is relative to the system Extension Class Library directory (./thinkphp/extend/library/)
4. Usage Four
Import (' Blog.Test.Translate ');
This type of writing is neither a @,think, nor a org,com, but is treated as a grouped project directory.
The parse result is: app/. /blog/lib/test/translate.class.php
Conclusion: The Fourth way of writing is relative to the Lib directory of the grouped items directory.
5. Usage Five
Import also supports alias import, using alias import, first define the alias file, establish alias.php in the project configuration directory, define the class library alias to be used in the project.
return
array
(
‘page‘
=> LIB_PATH.
‘Common/page.class.php‘
,
);
//这样使用即可
import(
‘page‘
);
thinkphp import record