2015-07-04
(1) Installing the Laravel frame
① Pre-installation preparations
Using Apache24 + PHP 5.6 + MySQL Development environment to complete the development of PHP Web site, so laravel installation is based on the above environment installation is successful and can be used under the premise.
② Installation composer
The Laravel framework uses Composer to manage its dependencies. So before you use Laravel, you have to make sure that you have Composer installed on your computer. Using the Composer-setup.exe (click to enter the network disk) to download the installation package can be easily installed composer.
③ installation Laravel
First use CMD to enter Apache24 's Htdocs directory (mine is D:\Program Files\web\apache24\htdocs), using the composer command:
Composer Create-project Laravel/laravel Laravel5
Install the Laravel framework with the following results:
(2) Create a database and add form data
① using phpMyAdmin to manage my database
② creating a new database named users
③ Create a new data table named users under Database and add the form data as follows
(3) using the Laravel framework to connect to a previously established database
Modify the Laravel5 folder root directory. env file code is as follows:
1app_env=Local2app_debug=true3app_key=8RPKQNTKU3BRN8RLYOJEPWZNNSJ05SKC4 5db_host=localhost6Db_database=Users7Db_username=Root8db_password=********9 TenCache_driver=file OneSession_driver=file AQueue_driver=Sync - -Mail_driver=SMTP themail_host=Mailtrap.io -mail_port=2525 -Mail_username=NULL -mail_password=NULL + /*The following four items are changed to their own database corresponding information can be - Db_host=localhost + db_database=users A Db_username=root at db_password=******** - */
View Code
After using the Laravel framework to connect the database, we can test our results in the browser directly using the login registration function of Laravel.
Enter the following address in the browser:
Http://localhost/laravel5/public/index.php/home
Open the interface as follows:
Click Register in the upper right corner to enter the registration screen:
After completing the registration information, you can log in and log in the results as follows:
Finally, look at your own database and find the information that has been filled in:
Laravel5 Study and use (i)