博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
laravel中数据库配置_Laravel中的配置
阅读量:2529 次
发布时间:2019-05-11

本文共 3461 字,大约阅读时间需要 11 分钟。

laravel中数据库配置

I hope, after reading the , you will understand the concept of why we use the Laravel framework, it's installation and It's important directories. It's pre-defined directories made easy everything creating a project to database work.

我希望,在阅读了的之后,您将了解为什么我们使用Laravel框架的概念,它的安装以及它的重要目录。 它的预定义目录使创建数据库项目的所有工作变得容易。

For further process, we need to configure our project to customize it. This configuration allows you to set values.

为了进行进一步的处理,我们需要配置项目以对其进行自定义。 此配置允许您设置值。

In the config directories, we will see a bunch of various PHP files here labeled each for a section of the application. Each of these files is loaded by laravel when your application processes a request means we can add new files if we need it.

在config目录中,我们将看到一堆各种PHP文件,其中每个文件都标记了应用程序的一部分。 当您的应用程序处理请求时,laravel会加载每个文件,这意味着我们可以根据需要添加新文件。

config/app.php: 'env' function with two-parameter where 'env' function gets the value from shell environment in which our application runs.

配置/ app.php:“ENV”有两个参数,其中“ENV”函数从shell环境,使我们的应用程序运行时的价值功能。

env(APP_NAME,'LARAVEL');
  • First parameter, APP_NAME which is used for the environmental variable to local.

    第一个参数APP_NAME用于将环境变量设置为local。

  • Second parameter, LARAVEL which is the default value to use if none is set.

    第二个参数LARAVEL是未设置的默认值。

timezone: This value is set as a static value if we want to change this value, we could. It means we may have a different timezone for our different environments.

时区:如果我们要更改此值,则可以将其设置为静态值。 这意味着我们针对不同的环境可能会有不同的时区。

Laravel uses an 'env' package for these environments get set or for timezone used regardless of where our application is running.

无论我们的应用程序在哪里运行,Laravel都会为这些环境设置或使用的时区使用“ env”包。

vendor: ' .env ' file (enviornment file) : [app_name='laravel']

供应商: '.env'文件(环境文件):[app_name ='laravel']

  • [app_env = homestead]: changes and see the changes on the browser on the main laravel page.

    [app_env = homestead] :更改并在laravel主页上的浏览器上查看更改。

  • If you remove this 'app_env' and save then you will see the production page on the main page on the browser.

    如果删除此“ app_env”并保存,则将在浏览器的主页上看到生产页面。

After installation, we have to do something for starting our new project or for Laravel Configuration.

安装后,我们必须做一些事情来启动我们的新项目或进行Laravel配置。

1) Create a new project

1)创建一个新项目

Check my previous article, , if you don't know how to create a new project in laravel.

如果您不知道如何在laravel中创建新项目,请查看我之前的文章 。

2) Database configuration on PHPMyAdmin using xampp server named "blog" (DB name). It means you have to create a database on PHPMyAdmin named "blog".

2)使用名为“ blog”(数据库名称)的xampp服务器在PHPMyAdmin上进行数据库配置。 这意味着您必须在PHPMyAdmin上创建一个名为“ blog”的数据库。

Note: you can also use your own database name.

注意:您也可以使用自己的数据库名称。

3) After this, you have to make changes in .env file which is known as environment file in Laravel.

3)之后,您必须在.env文件中进行更改,该文件在Laravel中称为环境文件。

DB_DATABASE -> 'blog',     DB_USERNAME -> 'root',     DB_PASSWORD -> 'null'
Configuration in Laravel | step 1

4) Now, Open the project run command on Command prompt to start the laravel server for using its pre-defined functionality.

4)现在,在命令提示符下打开项目运行命令,以启动laravel服务器以使用其预定义功能。

On CMD --> $ php artisan serve

在CMD上-> $ php artisan服务

Configuration in Laravel | step 2

5) Now, RUN on browser -> localhost:8000

5)现在,在浏览器上运行-> localhost:8000

Configuration in Laravel | step 3

Conclusion:

结论:

In this article, we are learned about the configuration of Laravel first project. I hope you will understand the concept. we will know more about it in the upcoming article. Have a nice day! Happy Learning!

在本文中,我们了解了Laravel first项目的配置 。 希望您能理解这个概念。 我们将在下一篇文章中进一步了解它。 祝你今天愉快! 学习愉快!

翻译自:

laravel中数据库配置

转载地址:http://zeazd.baihongyu.com/

你可能感兴趣的文章
[置顶] 【cocos2d-x入门实战】微信飞机大战之三:飞机要起飞了
查看>>
BABOK - 需求分析(Requirements Analysis)概述
查看>>
第43条:掌握GCD及操作队列的使用时机
查看>>
Windows autoKeras的下载与安装连接
查看>>
CMU Bomblab 答案
查看>>
微信支付之异步通知签名错误
查看>>
2016 - 1 -17 GCD学习总结
查看>>
linux安装php-redis扩展(转)
查看>>
Vue集成微信开发趟坑:公众号以及JSSDK相关
查看>>
技术分析淘宝的超卖宝贝
查看>>
i++和++1
查看>>
react.js
查看>>
P1313 计算系数
查看>>
NSString的长度比较方法(一)
查看>>
Azure云服务托管恶意软件
查看>>
My安卓知识6--关于把项目从androidstudio工程转成eclipse工程并导成jar包
查看>>
旧的起点(开园说明)
查看>>
生产订单“生产线别”带入生产入库单
查看>>
crontab导致磁盘空间满问题的解决
查看>>
java基础 第十一章(多态、抽象类、接口、包装类、String)
查看>>