Laravel 5 Basics (v)-Environment and configuration

Source: Internet
Author: User
Tags php tutorial
.envFiles are configuration files, including database configuration information, to view config->database.phpconnectionsIt contains the configuration of all the databases and can be defaultSelect the database that you want to use. In the database configuration, the env('DB_HOST', 'localhost')is to read .envThe information for the configuration file. The second parameter is a default parameter.

    • We use mysql the database to modify .env :
DB_HOST=localhostDB_DATABASE=laravelDB_USERNAME=rootDB_PASSWORD=
    • Create a database in MySQL laravel
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 the configuration files, and look at them.

The above describes the Laravel 5 Foundation (v)-environment and configuration, including the aspects of the content, I hope to be interested in PHP tutorial friends helpful.

  • 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.