• The config directory in the root directory contains all the configuration files

│ ├─config │ ├─app.php │ ├─cache. PHP │ ├─console. PHP │ ├─cookie. PHP cookie │ ├─database.php Database Configuration │ ├─ ├─lang. PHP multi-language │ ├─log.php Log │ ├─ Middleware │ ├─route.php URL │ ├─lang. PHP multi-language │ ├─ Log ├─ ├─ class.class.php ├─ ├─ class.class.php ├─ ├─ class.class.php ├─ ├─ class.class.php More Configuration Files

1. Project configuration

  • Show_error_msg The show_error_msg command is enabled locally but disabled when online
return [
    // Application address
    'app_host'         => env('app.host'.' '),
    // The namespace of the application
    'app_namespace'= >' '.// Whether to enable routing
    'with_route'= >true.// Default application
    'default_app'= >'index'.// The default time zone
    'default_timezone'= >'Asia/Shanghai'.// Application mapping (automatic multi-application mode works)
    'app_map'= > [].// Domain binding (valid in automatic multi-application mode)
    'domain_bind'= > [].// List of applications that prohibit URL access (valid in automatic multi-application mode)
    'deny_app_list'= > [].// The template file for the abnormal page
    'exception_tmpl'   => app()->getThinkPath() . 'tpl/think_exception.tpl'.// Error message is displayed, valid in non-debug mode
    'error_message'= >'Page error! Please try again later ~ '.// Error information is displayed
    'show_error_msg'= >true,];Copy the code

2. View View configuration

return [
    // The template engine type uses Think
    'type'= >'Think'.// Default template rendering rule 1 resolves to lowercase + underscore 2 converts all lowercase 3 keeps the operation method
    'auto_rule'= >1.// Template directory name
    'view_dir_name'= >'view'.// Template suffix
    'view_suffix'= >'html'.// Template file name delimiter
    'view_depr'     => DIRECTORY_SEPARATOR,
    // Template engine common tag start tag
    'tpl_begin'= >'{'.// Template engine common tag end tag
    'tpl_end'= >'} '.// Start tag of library tag
    'taglib_begin'= >'{'.// Tag library tag end tag
    'taglib_end'= >'} ',];Copy the code

3. Server configuration

return [
    // Database connection configuration used by default
    'default'         => env('database.driver'.'mysql'),

    // Customize time query rules
    'time_query_rule'= > [].// Write the timestamp field automatically
    // true indicates automatic identification. False Is disabled
    Int TIMESTAMP datetime date is supported
    'auto_timestamp'= >true.// The default time format after the time field is extracted
    'datetime_format'= >'Y-m-d H:i:s'.// Database connection configuration information
    'connections'= > ['mysql'= > [// Database type
            'type'            => env('database.type'.'mysql'),
            // Server address
            'hostname'        => env('database.hostname'.'127.0.0.1'),
            // Database name
            'database'        => env('database.database'.'ouyangke'),
            / / user name
            'username'        => env('database.username'.'root'),
            / / password
            'password'        => env('database.password'.'root'),
            / / port
            'hostport'        => env('database.hostport'.'3306'),
            // Database connection parameters
            'params'= > [].// The default database encoding is UTF8
            'charset'         => env('database.charset'.'utf8'),
            // Database table prefix
            'prefix'          => env('database.prefix'.' '),

            // Database deployment mode :0 centralized (single server),1 distributed (master/slave server)
            'deploy'= >0.// Whether database read/write separation is valid
            'rw_separate'= >false.// Number of primary servers after read/write separation
            'master_num'= >1.// Specify the serial number of the secondary server
            'slave_no'= >' '.// Check whether the field exists strictly
            'fields_strict'= >true.// Whether to disconnect and reconnect
            'break_reconnect'= >false./ / to monitor the SQL
            'trigger_sql'     => env('app_debug'.true),
            // Enable field caching
            'fields_cache'= >false,].// More database configuration information]];Copy the code

4. Env environment variable definition

  • The default installed root directory has a.example.env environment variable example file, you can directly change to
APP_DEBUG = true

[APP]
DEFAULT_TIMEZONE = Asia/Shanghai

[DATABASE]
TYPE = mysql
HOSTNAME = 127.0.0.1
DATABASE = test
USERNAME = username
PASSWORD = password
HOSTPORT = 3306
CHARSET = utf8
DEBUG = true

[LANG]
default_lang = zh-cn
Copy the code