Laravel 5 database issue

前端 未结 13 840
抹茶落季
抹茶落季 2020-12-15 04:24

I\'ve installed laravel 5 successfully by using this command:

composer create-project laravel/laravel test-laravel-5-project dev-develop --prefer-dist
         


        
13条回答
  •  -上瘾入骨i
    2020-12-15 05:08

    Laravel is using the variables contained in your .env file.

    From: http://laravel.com/docs/master/configuration

    It is often helpful to have different configuration values based on the environment the application is running in. For example, you may wish to use a different cache driver locally than you do on your production server. It's easy using environment based configuration.

    Laravel utilizes the DotEnv PHP library by Vance Lucas. In a fresh Laravel installation, the root directory of your application will contain a .env.example file. If you install Laravel via Composer, this file will automatically be renamed to .env. Otherwise, you should rename the file manually.

    All of the variables listed in this file will be loaded into the $_ENV PHP super-global when your application receives a request. You may use the env helper to retrieve values from these variables. In fact, if you review the Laravel configuration files, you will notice several of the options already using this helper!

    Feel free to modify your environment variables as needed for your own local server, as well as your production environment. However, your .env file should not be committed to your application's source control, since each developer / server using your application could require a different environment configuration.

    If you are developing with a team, you may wish to continue including a .env.example file with your application. By putting place-holder values in the example configuration file, other developers on your team can clearly see which environment variables are needed to run your application.

    The default .env file looks something like:

    APP_ENV=local
    APP_DEBUG=true
    APP_KEY=YOUR_KEY_HERE
    
    DB_HOST=localhost
    DB_DATABASE=homestead
    DB_USERNAME=homestead
    DB_PASSWORD=secret
    
    CACHE_DRIVER=file
    SESSION_DRIVER=file
    

提交回复
热议问题