The following is an introduction to several usages of import
1, the use of a
Import (' @. Test.translate ');
@, which represents the project root directory. Suppose 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 project directory's Lib directory
2. Usage Two
Import (' Think.Test.Translate ');
The system root directory. Both:./thinkphp/
The path to the Import class library is:./thinkphp/lib/test/translate.class.php
Conclusion: Import (' sense ') is relative to the system directory of the Lib directory
3. Usage Three
Import (' ORG. Test.translate ');
Or
Import (' COM. Test.translate ');
ORG, third-party common class Library Directory
COM, Enterprise common class Library Directory
Both types of writing are relative 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 kind of writing is not @,think, there is not org,com writing, will be treated as a grouped project directory.
The analytic result is: app/. /blog/lib/test/translate.class.php
Conclusion: The fourth way of writing is relative to the Lib directory of the grouped project directory.
5, the use of five
Import also supports alias import, using alias import, first define alias file, create alias.php in project configuration directory, define class library alias to be used in project.
Return Array (
' page ' => lib_path. ' common/page.class.php '
);
This can be used to
import (' page ');