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

WBOY
Release: 2016-07-13 09:57:44
Original
936 people have browsed it

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=
Copy after login

Create laravel database in mysql

mysql -u root 
CREATE DATABASE laravel
Copy after login

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,
 ],
Copy after login

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...
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template