Laravel 5 Framework learning environment and configuration _php Example

Source: Internet
Author: User
Tags create database

The. env file is a configuration file, including database configuration information, view config->database.php, connections contains the configuration of all databases, and you can select the database to use in default. In the database configuration, the env (' db_host ', ' localhost ') is the information that reads 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=

Creating a laravel database in MySQL

Mysql-u root 
CREATE DATABASE laravel

To view the 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, include all of the configuration files and view them.

The above mentioned is the whole content of this article, hope to be able to learn Laravel5 frame to be helpful to everybody.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.