How to configure environment variables in thinkphp6
The thinkphp tutorial column below will introduce you to the method of configuring environment variables in thinkphp6. I hope it will be helpful to friends in need!
1. General configuration
config
The folder is tp6
's regular configuration file, in the config
folder we can modify the configuration inside or customize the configuration file. But do not modify the names and contents of these configuration files when we are not familiar with them, as this may cause the files to become unusable.
##2. envEnvironment variable definition
Configurationenv
.example.env in the root directory. You can directly Change
.example.env to
.env for modification.
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
APP_DEBUG is to enable the
tp6 test mode,
APP_DEBUG = true means that the test mode has been enabled.
Calling env
think\facade\Env facade class to obtain the environment variables There is no need to be case sensitive.
DATABASE (database),
USERNAME (user name),
PASSWORD in .env
(password) content needs to be modified as follows:
DATABASE = tp USERNAME = root PASSWORD = root
database.php also needs to be modified as follows:
// 数据库名 'database' => env('database.database', 'tp'), // 用户名 'username' => env('database.username', 'root'), // 密码 'password' => env('database.password', 'root'),
The latest 10 thinkphp video tutorials
The above is the detailed content of How to configure environment variables in thinkphp6. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)
