System Constants and Predefined Constant Sets in ThinkPHP

  • 2021-07-07 06:40:06
  • OfStack

ThinkPHP system constants and predefined constants are summarized as follows:

1. System constants:

THINK_PATH//ThinkPHP System Directory:
APP_PATH//Current Project Directory
APP_NAME//Current Project Name
MODULE_NAME//Current module name
ACTION_NAME//Current operation name
TMPL_PATH//Project Template Catalog
LIB_PATH//Project Class Library Directory
CACHE_PATH//Project Template Cache Directory
CONFIG_PATH//Project Profile Directory
LOG_PATH//Project Log File Directory
LANG_PATH//Project Language Files Directory
TEMP_PATH//Project Temporary Files Directory
PLUGIN_PATH//Project plug-in file directory
VENDOR_PATH//Party 3 Class Library Directory
DATA_PATH//Project Data File Directory
Does IS_APACHE//belong to Apache
Whether IS_IIS//belongs to IIS
Is IS_WIN//in an Windows environment
Is IS_LINUX//in an Linux environment
Is IS_FREEBSD//in an FreeBsd environment
NOW_TIME//Current timestamp
MEMORY_LIMIT_ON//Is there a memory usage limit
MEMORY_LIMIT_ON//Is there a memory usage limit
OUTPUT_GZIP_ON//Turn on output compression
MAGIC_QUOTES_GPC // MAGIC_QUOTES_GPC
THINK_VERSION//ThinkPHP version number
LANG_SET//Browser language
TEMPLATE_NAME//Current template name
TEMPLATE_PATH//Current template path
__ROOT__//Site root address
__APP__//Current project (entry file) address
__URL__//Current module address
__ACTION__//Current Operation Address
__SELF__//Current URL address
TMPL_FILE_NAME//Default template name (including path) for the current operation
WEB_PUBLIC_URL//Site Public Directory
APP_PUBLIC_URL//Project Common Template Directory

2. Predefined constants:

WEB_LOG_ERROR=0//Error Log Type
WEB_LOG_DEBUG=1//Debug Log Type
SQL_LOG_DEBUG=2//SQL Log Type
SYSTEM_LOG=0//System Logging
MAIL_LOG=1//Mail Logging
Logging in TCP_LOG=2//TCP mode
FILE_LOG=3//Log in file mode
DATA_TYPE_OBJ=1// Returns as an object
DATA_TYPE_ARRAY=0//Return as an array
URL_COMMON=0//Normal Mode URL
URL_PATHINFO=1 // PATHINFO URL
URL_REWRITE=2 // REWRITE 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
EXISTS_TO_VAILIDATE = 0//Validate if the form has a field
MUST_TO_VALIDATE = 1//Must be validated
VALUE_TO_VAILIDATE = 2//Validate if the form value is not empty


Related articles: