当前位置:网站首页>Environment configuration of lavarel env
Environment configuration of lavarel env
2022-07-07 13:51:00 【Full stack programmer webmaster】
.env The file is located in the root directory of the project , As a global environment configuration file .
1. Configuration parameters
// Running environment name APP_ENV=local // Debug mode , Development phase enabled , Online status is disabled . APP_DEBUG=true // Sensitive information encryption key , You can use php artisan key:generate To regenerate the . APP_KEY= // Project root APP_URL=http://localhost // Cache drive , File is used as cache by default . CACHE_DRIVER=file // Call back drive , Use file storage by default SESSION. SESSION_DRIVER=file // Queue driven , Synchronous mode is used by default . QUEUE_DRIVER=sync // Redis High performance key-value database , Use memory storage , For data persistence . REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379 // Database configuration items DB_HOST=127.0.0.1// Database host name DB_PORT=3306// Database port DB_DATABASE=homestead// Database name DB_USERNAME=homestead// Database login account DB_PASSWORD=secret// Database login password
[ doubt ].env
How does the environment configuration work in the project ? .env
The document is actually right /config/
Extract the general configuration under the directory . see /config/app.php
Can be found , The system provides env()
For reading .env
File configuration .
[ doubt ].env
The database configuration of does not have the setting of data table prefix , What to do ? see /config/database.php
Provided in the document prefix
Fields can be modified , Can be in .env
Add... To the file DB_PREFIX
To configure , And in /config/database.php
modify prefix
The options are env(DB_PREFIX,'')
.
2. Get configuration
env() Use env()
Available .env
Global general configuration in the file . for example :env('DB_HOST')
config() Use config()
Available /config/
Configuration item information of items under the directory . for example :config('database.connections.mysql.prefix')
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/113301.html Link to the original text :https://javaforall.cn
边栏推荐
猜你喜欢
《厌女:日本的女性嫌恶》摘录
数据库系统概论-第一章绪论【概念模型、层次模型和三级模式(外模式、模式、内模式)】
Custom thread pool rejection policy
Cmake learning and use notes (1)
1、深拷贝 2、call apply bind 3、for of for in 区别
Introduction to database system - Chapter 1 introduction [conceptual model, hierarchical model and three-level mode (external mode, mode, internal mode)]
Mathématiques avancées - - chapitre 8 différenciation des fonctions multivariables 1
Ogre introduction
DID登陆-MetaMask
【堡垒机】云堡垒机和普通堡垒机的区别是什么?
随机推荐
Navicat run SQL file import data incomplete or import failed
Introduction and basic use of stored procedures
Cinnamon taskbar speed
Detr introduction
Supply chain supply and demand estimation - [time series]
Mongodb meets spark (for integration)
[high frequency interview questions] difficulty 2.5/5, simple combination of DFS trie template level application questions
2022-7-6 Leetcode27.移除元素——太久没有做题了,为双指针如此狼狈的一天
Write it down once Net a new energy system thread surge analysis
Milkdown control icon
Laravel Form-builder使用
Redis只能做缓存?太out了!
Problems that cannot be accessed in MySQL LAN
2022-7-6 使用SIGURG来接受外带数据,不知道为什么打印不出来
Mongodb slice summary
Solve the cache breakdown problem
Build a secure and trusted computing platform based on Kunpeng's native security
Digital IC Design SPI
[fortress machine] what is the difference between cloud fortress machine and ordinary fortress machine?
Thread pool reject policy best practices