ThinkPHP notes-full configuration Reference Manual

Source: Internet
Author: User
Tags autoload

ThinkPHP2.0 Configuration

CHECK_FILE_CASE -- strictly check the case in windows.

/* Project Settings */
'App _ debug' => false, // whether to enable the debugging mode
'App _ DOMAIN_DEPLOY '=> false, // whether to deploy the project with an independent domain name
'App _ PLUGIN_ON '=> false, // whether to enable the plug-in mechanism
'App _ FILE_CASE '=> false, // check whether the file is case-sensitive for Windows Platforms
'App _ GROUP_DEPR '=>'. ', // delimiter between group modules
'App _ GROUP_LIST '=> '', // project grouping settings. Multiple groups are separated by commas (,), for example, 'home, admin'
'App _ AUTOLOAD_REG '=> false, // whether to enable SPL_AUTOLOAD_REGISTER
'App _ AUTOLOAD_PATH '=> 'think. Util.', // _ autoLoad mechanism for additional detection path settings, pay attention to the search order
'App _ CONFIG_LIST '=> array ('taglibs', 'routes', 'tags', 'htmls', 'modules', 'actions '), // The configuration list to be loaded for the project. The default options include taglibs (TAG library definition), routes (route definition), tags (TAG definition), and htmls static cache definition, modules and actions)

/* Cookie settings */
'Cookie _ EXPIRE '=> 3600, // Coodie Validity Period
'Cookie _ DOMAIN '=> '', // valid cookie domain Name
'Cookie _ path' => '/', // COOKIE PATH
'Cookie _ prefix' => '', // avoid conflict with the COOKIE PREFIX

/* Default setting */
'Default _ app' => '@', // DEFAULT project name, @ indicates the current project
'Default _ group' => 'home', // DEFAULT GROUP
'Default _ module' => 'index', // default module name
'Default _ action' => 'index', // DEFAULT operation name
'Default _ charset' => 'utf-8', // DEFAULT output Encoding
'Default _ TIMEZONE '=> 'prc', // DEFAULT Time Zone
'Default _ AJAX_RETURN '=> 'json', // default ajax data return format, optional json xml...
'Default _ THEME '=> 'default', // DEFAULT template topic name
'Default _ lang' => 'zh-cn', // DEFAULT language

/* Database settings */
'Db _ type' => 'mysql', // Database TYPE
'Db _ host' => 'localhost', // server address
'Db _ name' => '', // Database NAME
'Db _ user' => 'root', // USER Name
'Db _ pwd' => '', // Password
'Db _ port' => 3306, // PORT
'Db _ prefix' => 'think _ ', // database table PREFIX
'Db _ SUFFIX '=> '', // database table SUFFIX
'Db _ FIELDTYPE_CHECK '=> false, // whether to check the field type
'Db _ FIELDS_CACHE '=> true, // enable field caching
'Db _ charset' => 'utf8', // The database encoding uses utf8 by default.
'Db _ DEPLOY_TYPE '=> 0, // database deployment method: 0 centralized (Single Server), 1 distributed (Master/Slave server)
'Db _ RW_SEPARATE '=> false, // whether the master-slave mode is valid for database read/write splitting

/* Data cache settings */
'Data _ CACHE_TIME '=>-1, // DATA cache Validity Period
'Data _ CACHE_COMPRESS '=> false, // whether the DATA cache compresses the cache
'Data _ CACHE_CHECK '=> false, // whether the DATA cache verifies the cache
'Data _ CACHE_TYPE '=> 'file', // DATA cache type, supported: File | Db | Apc | Memcache | Shmop | Sqlite | Xcache | Apachenote | Eaccelerator
'Data _ CACHE_PATH '=> TEMP_PATH, // cache path setting (only valid for File Cache)
'Data _ cache_subdir' => false, // use sub-directory cache (automatically create sub-directories Based on the hash of the cache ID)
'Data _ PATH_LEVEL '=> 1, // sub-directory cache level

/* Error setting */
'Error _ message' => 'An ERROR occurred temporarily on the page you browsed! Please try again later ~ ', // Error display information, not in debug mode
'Error _ page' => '', // ERROR targeting PAGE

/* Static cache settings */
'Html _ CACHE_ON '=> false, // The static cache is disabled by default.
'Html _ CACHE_TIME '=> 60, // static cache Validity Period
'Html _ READ_TYPE '=> 0, // static cache read method 0 readfile 1 redirect
'Html _ FILE_SUFFIX '=> '.shtml', // default static file suffix

/* Language settings */
'Lang _ SWITCH_ON '=> false, // The multi-language Package function is disabled by default.
'Lang _ AUTO_DETECT '=> true, // the automatic detection language is valid after the multi-language function is enabled.

/* Log settings */
'Log _ RECORD '=> false, // No logs are recorded by default.
'Log _ FILE_SIZE '=> 2097152, // LOG File Size Limit
'Log _ RECORD_LEVEL '=> array ('error', 'alert', 'crit', 'err'), // The LOG level that can be recorded

/* Paging settings */
'Page _ rollpage' => 5, // Number of pages displayed on the PAGE
'Page _ LISTROWS '=> 20, // number of records displayed per PAGE

/* SESSION settings */
'Session _ AUTO_START '=> true, // whether to enable the SESSION automatically
// Built-in available SESSION parameters
// 'Session _ name' => '', // SESSION NAME
// 'Session _ path' => '', // SESSION storage PATH
// 'Session _ callback' => '', // CALLBACK function for SESSION Object deserialization

/* Set the running time */
'Show _ RUN_TIME '=> false, // Run Time Display
'Show _ adv_time' => false, // displays the detailed running time.
'Show _ DB_TIMES '=> false, // displays the number of database queries and writes.
'Show _ CACHE_TIMES '=> false, // displays the number of cache operations
'Show _ USE_MEM '=> false, // Display memory overhead
'Show _ PAGE_TRACE '=> false, // The Trace information of the displayed page is defined by the Trace file and assigned values for Action operations.
'Show _ ERROR_MSG '=> true, // the error message is displayed.

/* Template engine settings */
'Tmpl _ ENGINE_TYPE '=> 'think', // The default template engine. The following settings are only valid for the Think template engine.
'Tmpl _ DETECT_THEME '=> false, // automatically detects the template topic
'Tmpl _ TEMPLATE_SUFFIX '=> '.html', // default template file suffix
'Tmpl _ CACHFILE_SUFFIX '=>'. php', // default template cache suffix
'Tmpl _ DENY_FUNC_LIST '=> 'echo, exit', // The template engine disables the function.
'Tmpl _ PARSE_STRING '=> '', // the string to be automatically replaced by the template engine, which must be an array.
'Tmpl _ L_DELIM '=>' {', // template engine common tag start tag
'Tmpl _ R_DELIM '=>'} ', // template engine common tag end tag
'Tmpl _ VAR_IDENTIFY '=> 'array', // template variable identification. If this parameter is left blank, it is automatically judged. If the parameter is 'obj ', it indicates the object.
'Tmpl _ STRIP_SPACE '=> false, // whether to remove html spaces and line breaks in the template file
'Tmpl _ CACHE_ON '=> true, // whether to enable template compilation cache. If it is set to false, the template will be re-compiled every time.
'Tmpl _ CACHE_TIME '=>-1, // The template cache validity period-1 is permanent (in numbers, unit: seconds)
'Tmpl _ ACTION_ERROR '=> 'public: success', // default error jumps to the corresponding Template File
'Tmpl _ ACTION_SUCCESS '=> 'public: success', // The template file is successfully redirected by default.
'Tmpl _ TRACE_FILE '=> THINK_PATH.'/Tpl/PageTrace. tpl. php', // template file of page Trace
'Tmpl _ EXCEPTION_FILE '=> THINK_PATH.'/Tpl/ThinkException. tpl. php', // template file of the exception page
'Tmpl _ file_depr' => '/', // delimiter between MODULE_NAME and ACTION_NAME in the template file, which is only valid for Project Group deployment.
// Think template engine tag library settings
'Taglib _ begin' => '<', // tag library Label Start marking
'Taglib _ end' => ', // tag END tag of the tag Library
'Taglib _ load' => true, // whether to use a tag library other than the built-in tag library. It is automatically detected by default.
'Taglib _ BUILD_IN '=> 'cx', // The name of the built-in tag Library (tag names are separated by commas (,).
'Taglib _ PRE_LOAD '=> '', // The tag library to be loaded (the name of the tag library must be specified), separated by commas
'Tag _ NESTED_LEVEL '=> 3, // TAG nesting level
'Tag _ EXTEND_PARSE '=> '', // specify the name of the function that extends the definition and resolves the common TAG.

/* Form token verification */
'Token _ on' => true, // enable TOKEN Verification
'Token _ name' => '_ hash _', // NAME of the hidden field in the form for TOKEN Verification
'Token _ type' => 'md5', // TOKEN verification hash rule

/* URL setting */
'Url _ CASE_INSENSITIVE '=> false, // whether the URL address is case insensitive
'Url _ ROUTER_ON '=> false, // whether to enable URL Routing
'Url _ DISPATCH_ON '=> true, // whether to enable Dispatcher
'Url _ model' => 1, // URL access mode. Optional parameters: 0, 1, 2, and 3, which represent the following four modes:
// 0 (normal mode); 1 (PATHINFO mode); 2 (REWRITE mode); 3 (compatible mode): valid when URL_DISPATCH_ON is enabled; PATHINFO mode is used by default, provide the best user experience and SEO support
'Url _ PATHINFO_MODEL '=> 2, // PATHINFO mode. numbers 1, 2, and 3 represent the following three modes:
// 1 normal mode (parameters have no order, for example,/m/module/a/action/id/1 );
// 2 intelligent mode (the default mode used by the system, which can automatically identify the module and operation/module/action/id/1 // or/module, action, id, 1 /...);
// 3 compatibility mode (pass PATHINFO to dispather through a GET variable. The default value is s index. php? S =/module/action/id/1)
'Url _ PATHINFO_DEPR '=>'/', // The delimiter between parameters in PATHINFO mode.
'Url _ HTML_SUFFIX '=> '', // URL pseudo-static suffix settings

/* Set the system variable name */
'Var _ group' => 'G', // get the variable by default GROUP
'Var _ module' => 'M', // The default MODULE obtains the variable.
'Var _ action' => 'A', // get the variable by default
'Var _ ROUTER '=> 'R', // obtain the variable from the default route
'Var _ page' => 'P', // default paging jump variable
'Var _ template' => 'T', // default TEMPLATE switch variable
'Var _ language' => 'l', // default LANGUAGE switch variable
'Var _ AJAX_SUBMIT '=> 'ajax', // default ajax submission variable
'Var _ pathinfo' =>'s ', // obtain the variable in the PATHINFO compatibility mode, for example? The parameters after s =/module/action/id/1 depend on URL_PATHINFO_MODEL and URL_PATHINFO_DEPR.

------------------------------------------------ 1.6RC1 + version configuration ThinkPhp

2009/09/30

ThinkPhp Configuration Guide and reference-template Configuration

TMPL_SWITCH_ON= True

Multi-template is enabled by default.

TMPL_CACHE_ON= True

Template cache is enabled by default.

TMPL_CACHE_TIME=-1

Template cache validity period-1 permanent unit: seconds

DEFAULT_TEMPLATE= 'Default'

Default template style name

TEMPLATE_SUFFIXLogin '.html'

Default template file suffix

CACHFILE_SUFFIX= '. Php'

Default template cache suffix

TEMPLATE_CHARSET= 'Utf-8 ′

Template template Encoding

OUTPUT_CHARSET= 'Utf-8 ′

Default output Encoding

Yanzhilu

Comments (0) ThinkPhpThinkPhp Configuration Guide and reference-module and operation configuration

Tags: php, ThinkPhp

DEFAULT_MODULE= 'Index'

Default Module name

DEFAULT_ACTION= 'Index'

Default operation name

Yanzhilu

Comments (0) ThinkPhpThinkPhp Configuration Guide and reference-variable configuration

Tags: php, ThinkPhp

VAR_PATHINFO='S'

The PATHINFO compatibility mode obtains variables such? The parameters after s =/module/action/id/1 depend on PATH_MODEL and PATH_DEPR.

VAR_MODULE= 'M'

Get variable by default Module

VAR_ACTION= 'A'

Get variables by default

VAR_ROUTER= 'R'

Get variables by default route

VAR_FILE= 'F'

Default file variable

VAR_PAGE= 'P'

Default paging jump variable

VAR_LANGUAGE= 'L'

Default language switch variable

VAR_TEMPLATE= 'T'

Default template switch variable

VAR_AJAX_SUBMIT= 'Ajax'

Default AJAX submit variable

Yanzhilu

Comments (0) ThinkPhpThinkPhp Configuration Guide and reference-error settings

Tags: php, ThinkPhp

DEBUG_MODE= False

Debug mode is disabled by default.

ERROR_MESSAGE= 'The page you browsed has a temporary error! Please try later ~ '

Error display information is not valid in debug mode

ERROR_PAGE="

Error targeting page

SHOW_ERROR_MSG= True

Whether to display the error message. The default error message is displayed.

Yanzhilu

Comments (0) ThinkPhpThinkPhp Configuration Guide and reference-page refresh settings

Tags: php, ThinkPhp

LIMIT_RESFLESH_ON= False

The anti-Refresh mechanism is disabled by default.

LIMIT_REFLESH_TIMES= 3

The default page anti-Refresh time is 3 seconds.

Yanzhilu

Comments (0) ThinkPhpThinkPhp Configuration Guide and reference-plug-in settings

Tags: php, ThinkPhp

THINK_PLUGIN_ON= False

The plug-in mechanism is disabled by default.

Yanzhilu

Comments (0) ThinkPhpThinkPhp Configuration Guide and reference-log Configuration

Tags: php, ThinkPhp

WEB_LOG_RECORD= False

No logs are recorded by default.

LOG_FILE_SIZE= 2097152

Log File Size Limit

Yanzhilu

Comments (0) ThinkPhpThinkPhp Configuration Guide and reference-URL Configuration

Tags: php, ThinkPhp

DISPATCH_ON= True

Enable Dispatcher?

DISPATCH_NAME= 'Think'

Default Dispatcher name

URL_MODEL= 1

URL mode: 0 Normal Mode 1 PATHINFO Mode 2 REWRITE Mode 3 compatible mode

The default PATHINFO mode provides the best user experience and SEO support.

PATH_MODEL= 2

// Parameter mode in PATHINFO Mode

// Normal Mode 1 parameter no order/m/module/a/action/id/1

// Intelligent mode 2 automatically identifies modules and Operations/module/action/id/1 // module, action, id, 1 /...

Smart mode is used by default.

PATH_DEPR= '/'

Delimiter between PATHINFO Parameters

ROUTER_ON= True

Enable route determination

COMPONENT_DEPR= '@'

Component module and operation URL delimiter

COMPONENT_TYPE= 1

Component directory structure

1 Lib \ User \ Action \

2 Lib \ Action \ User \

URL_CASE_INSENSITIVE= False

Whether the URL is case-insensitive. The default value is case-insensitive.

Yanzhilu

Comments (0) ThinkPhpThinkPhp Configuration Guide and reference-configuration output

Tags: php, ThinkPhp

Static variables are used to access ThinkPHP configuration parameters to ensure the access speed. In the view layer, you can use the template tag to directly display the parameters of the configuration, without assigning values to the template.
The tag usage for reading configuration parameters is as follows:

{$ Think. config. parameter name}

Yanzhilu

Comments (0) ThinkPhpThinkPhp Configuration Guide and reference-dynamic configuration

Tags: php, ThinkPhp

In the specific Action method, we can still dynamically configure some parameters, mainly those that are not yet used.

// Obtain the set parameter values:

C ('parameter name ')

// Set the new value:

C ('parameter name', 'new parameter value ');

In version 1.5, the C method also supports two-dimensional array access and uses the dot syntax for access, as shown below:

// Obtain the set parameter values:

C ('user _ CONFIG. USER_TYPE ')

// Set the new value:

C ('user _ CONFIG. USER_TYPE ', '1 ′);

Yanzhilu

 

--------------------------------------------------

<? Php
/**
+ ----------------------------------------------------------
* ThinkPHP2.0 configuration change description
+ ----------------------------------------------------------
*/

2.0 configuration name 1.6RC1 + version configuration name
**************************************** *******
/* Project Settings */
'App _ debug' -----> 'debug _ mode ',
'App _ PLUGIN_ON '-----> 'tag _ PLUGIN_ON ',
'App _ FILE_CASE '-----> 'check _ FILE_CASE ',
'App _ GROUP_DEPR '-----> 'group _ demo', // 2.0 new
'App _ GROUP_LIST '-----> 'app _ group', // 2.0 new
'App _ AUTOLOAD_REG '-----> 'autoload _ REG', // 2.0 new
'App _ AUTOLOAD_PATH '-----> 'Auto _ LOAD_PATH ',
'App _ CONFIG_LIST '-----> 'extend _ CONFIG_LIST ',

/* Default setting */
'Default _ app' -----> 'default _ MODEL_APP ',
'Default _ group' -----> // 2.0 add
'Default _ charset' -----> 'output _ charset ',
'Default _ TIMEZONE '-----> 'time _ ZONE ',
'Default _ AJAX_RETURN '-----> 'ajax _ RETURN_TYPE ',
'Default _ LANG '-----> 'default _ Language', 'lang _ default ',
'Default _ THEME '-----> 'tmpl _ DEFAULT_THEME ',

/* Database settings */
'Db _ FIELDTYPE_CHECK '-----> // 2.0 add

/* Language settings */
'Lang _ AUTO_DETECT '-----> 'Auto _ DETECT_LANG ',

/* Log settings */
'Log _ RECORD '-----> 'web _ LOG_RECORD ',

/* Paging settings */
'Page _ rollpage' -----> 'page _ NUMBERS ',
'Page _ LISTROWS '-----> 'list _ NUMBERS ',

/* Template engine settings */
'Tmpl _ DEFAULT_THEME '-----> 'default _ template ',
'Tmpl _ DETECT_THEME '-----> 'Auto _ DETECT_THEME ',
'Tmpl _ TEMPLATE_SUFFIX '-----> 'template _ SUFFIX ',
'Tmpl _ CACHFILE_SUFFIX '-----> 'cachfile _ SUFFIX ',
'Tmpl _ PARSE_STRING '-----> // 2.0 add
'Tmpl _ VAR_IDENTIFY '-----> // 2.0 new,
'Tmpl _ STRIP_SPACE '-----> // 2.0 new,

'Tmpl _ ACTION_ERROR '-----> // 2.0 new,
'Tmpl _ ACTION_SUCCESS '-----> 'Action _ JUMP_TMPL ',
'Tmpl _ TRACE_FILE '-----> // 2.0 new,
'Tmpl _ EXCEPTION_FILE '-----> // 2.0 new,
'New TMPL _ file_depr' -----> // 2.0,

// Think template engine tag library settings
'Taglib _ load' -----> // modify the 2.0 Function
'Taglib _ BUILD_IN '-----> // 2.0 new,
'Taglib _ PRE_LOAD '-----> 'taglib _ list ',
'Tag _ EXTEND_PARSE '-----> // 2.0 new,

/* Form token verification */
'Token _ on' -----> // 2.0 add
'Token _ name' -----> // 2.0 add
'Token _ type' -----> // 2.0 add

/* URL setting */
'Url _ CASE_INSENSITIVE '-----> // 2.0 add
'Url _ ROUTER_ON '-----> 'router _ on ',
'Url _ DISPATCH_ON '-----> 'dispatch _ on ',
'Url _ PATHINFO_MODEL '-----> 'path _ model ',
'Url _ pathinfo_depr' -----> 'path _ dest ',
'Url _ HTML_SUFFIX '-----> 'html _ URL_SUFFIX ',

/* Set the system variable name */
'Var _ group' -----> // 2.0 add

?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.