Home  >  Article  >  Backend Development  >  Laravel 5 framework learning environment and configuration, laravel5 framework environment_PHP tutorial

Laravel 5 framework learning environment and configuration, laravel5 framework environment_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 09:57:44933browse

Laravel 5 framework learning environment and configuration, laravel5 framework environment

.env file is a configuration file, including database configuration information, check config->database.php, inside connections Contains the configuration of all databases, you can select the database to use in default. In the database configuration, env('DB_HOST', 'localhost') is to read the information from the .env configuration file. The second parameter is the default parameter.

We use mysql database, modify .env:

DB_HOST=localhost
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=

Create laravel database in mysql

mysql -u root 
CREATE DATABASE laravel

View mysql configuration:

  'mysql' => [
  'driver'  => 'mysql',
  'host'   => env('DB_HOST', 'localhost'),
  'database' => env('DB_DATABASE', 'forge'),
  'username' => env('DB_USERNAME', 'forge'),
  'password' => env('DB_PASSWORD', ''),
  'charset'  => 'utf8',
  'collation' => 'utf8_unicode_ci',
  'prefix'  => '',
  'strict'  => false,
 ],

In the config subdirectory, all configuration files are included, take a look.

The above is the entire content of this article. I hope it will be helpful to everyone learning the Laravel5 framework.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/980215.htmlTechArticleLaravel 5 framework learning environment and configuration, laravel5 framework environment.env file is a configuration file, including database configuration information, View config-database.php, connections contains all...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn