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-cnAmong them,
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 = rootAt the same time,
database.php also needs to be modified as follows:
// 数据库名 'database' => env('database.database', 'tp'), // 用户名 'username' => env('database.username', 'root'), // 密码 'password' => env('database.password', 'root'),Related recommendations:
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!

The article discusses ThinkPHP's built-in testing framework, highlighting its key features like unit and integration testing, and how it enhances application reliability through early bug detection and improved code quality.

Article discusses using ThinkPHP for real-time stock market data feeds, focusing on setup, data accuracy, optimization, and security measures.

The article discusses key considerations for using ThinkPHP in serverless architectures, focusing on performance optimization, stateless design, and security. It highlights benefits like cost efficiency and scalability, but also addresses challenges

The article discusses implementing service discovery and load balancing in ThinkPHP microservices, focusing on setup, best practices, integration methods, and recommended tools.[159 characters]

ThinkPHP's IoC container offers advanced features like lazy loading, contextual binding, and method injection for efficient dependency management in PHP apps.Character count: 159

The article discusses using ThinkPHP to build real-time collaboration tools, focusing on setup, WebSocket integration, and security best practices.

ThinkPHP benefits SaaS apps with its lightweight design, MVC architecture, and extensibility. It enhances scalability, speeds development, and improves security through various features.

The article outlines building a distributed task queue system using ThinkPHP and RabbitMQ, focusing on installation, configuration, task management, and scalability. Key issues include ensuring high availability, avoiding common pitfalls like imprope


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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 English version
Recommended: Win version, supports code prompts!

SublimeText3 Chinese version
Chinese version, very easy to use

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool