Home > Backend Development > PHP Tutorial > thinkPHP3.x constant arrangement (predefined constants/path constants/system constants), thinkphp3.x constants_PHP tutorial

thinkPHP3.x constant arrangement (predefined constants/path constants/system constants), thinkphp3.x constants_PHP tutorial

WBOY
Release: 2016-07-12 08:50:29
Original
924 people have browsed it

organize thinkPHP3.x constants (predefined constants/path constants/system constants), thinkphp3.x constants

This article summarizes the commonly used constants in thinkPHP3.x. Share it with everyone for your reference, the details are as follows:

1. Predefined constants

URL_COMMON=0 Normal mode URL
URL_PATHINFO=1 PATHINFO URL
URL_REWRITE=2 REWRITE URL
URL_COMPAT=3 compatibility mode URL
HAS_ONE=1 HAS_ONE association definition
BELONGS_TO=2 BELONGS_TO association definition
HAS_MANY=3 HAS_MANY association definition
MANY_TO_MANY=4 MANY_TO_MANY association definition
THINK_VERSION framework version number

These predefined constants will not change as the environment changes.

2. Path constants

System and project path constants are used for the system's default directory specifications and can be changed by redefining them. If you do not want to customize the directory, these constants generally do not need to be changed.

CORE_PATH system core class library directory THINK_PATH.'Lib/'
EXTEND_PATH system extension directory THINK_PATH.'Extend/'
MODE_PATH mode extension directory EXTEND_PATH.'Mode/'
ENGINE_PATH engine extension directory EXTEND_PATH.'Engine/'
VENDOR_PATH Third-party library directory EXTEND_PATH.'Vendor/'
LIBRARY_PATH system extension class library directory EXTEND_PATH.'Library/'
COMMON_PATH project public directory APP_PATH.'Common/'
LIB_PATH project library directory APP_PATH.'Lib/'
RUNTIME_PATH project runtime directory APP_PATH.'Runtime/'
CONF_PATH project configuration directory APP_PATH.'Conf/'
LOG_PATH project log directory RUNTIME_PATH.'Logs/'
CACHE_PATH project template cache directory RUNTIME_PATH.'Cache/'
LANG_PATH project language pack directory APP_PATH.'Lang/'
TEMP_PATH project cache directory RUNTIME_PATH.'Temp/'
DATA_PATH project data directory RUNTIME_PATH.'Data/'
TMPL_PATH project template directory APP_PATH.'Tpl/'
HTML_PATH project static cache directory APP_PATH.'Html/'

3. System constants

The following system constants will change with changes in the development environment or settings.

IS_CGI Whether it belongs to CGI mode
IS_WIN Whether it belongs to Windows environment
IS_CLI Whether it belongs to command line mode
__ROOT__ Website root directory address
__APP__ Current project (entry file) address
__GROUP__ The URL address of the current group
__URL__ The URL address of the current module
__ACTION__ The URL address of the current operation
__SELF__ Current URL address
__INFO__ current PATH_INFO string
APP_NAME current project name
GROUP_NAME Current group name
MODULE_NAME current module name
ACTION_NAME Current operation name
APP_DEBUG Whether to enable debugging mode
MODE_NAME Current mode name
APP_PATH current project path
THINK_PATH system framework path
MEMORY_LIMIT_ON system memory statistics support
RUNTIME_FILE project compilation cache file name
THEME_NAME Current theme name
THEME_PATH current template theme path
APP_TMPL_PATH current template URL path
LANG_SET Current browser language
MAGIC_QUOTES_GPC MAGIC_QUOTES_GPC

Readers who are interested in more thinkPHP-related content can check out the special topics on this site: "Introduction to ThinkPHP Tutorial", "Summary of Common Methods of ThinkPHP", "Summary of Cookie Usage in PHP", "Basic Tutorial for Getting Started with Smarty Templates" and "PHP Template technology summary".

I hope this article will be helpful to everyone’s PHP programming based on the ThinkPHP framework.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1133129.htmlTechArticlethinkPHP3.x constants arrangement (predefined constants/path constants/system constants), thinkphp3.x constants arrangement and summary of this article The commonly used constants in thinkPHP3.x are obtained. Share it with everyone for your reference, the details are as follows...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template