PHP configuration background login and template introduction

Source: Internet
Author: User
This document describes how to configure background logon in PHP and how to introduce a template. It has good reference value. let's take a look at it below (1) under the project. env is the file for configuring the database.

DB_HOST=127.0.0.1DB_DATABASE=blogDB_PREFIX=blog_DB_USERNAME=rootDB_PASSWORD=123.comg

Write the database server address, connected database name, table prefix, user name, and password respectively.

The table prefix DB_PREFIX field does not exist by default. you need to add

'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' => env('DB_PREFIX', ''),   'strict' => false,   'engine' => null,  ],

(2) Check whether the verification is successful

Create a controller

Php artisan make: controller IndexController

 getPdo();  dd($pdo); }}

Add route information:

Route: get ('/test', 'indexcontroller @ index ');

Verification result:

(3) import the prepared template

Rename server. php to index. php, and move public/. htaccess to the project directory. it is in the same directory as index. php. // at this time, it can be accessed in the form of 127.0.0.1 without public access.

Add the template admin to the views directory.

Add route:

Route: get ('/admin/login', 'admin \ LoginController @ login ');

Modify the controller LoginController. php

public function login() { return view('admin.login');}

Change views/admin/login.html to login. blade. php.

During access, pay attention to whether the css file is loaded

 
 

Result:

Note: The background template and the xampp installation package are in the following link:

Http://pan.baidu.com/s/1hs5Jass

The above is all the content of this article. I hope this article will help you in your study or work, and I also hope to support PHP!

For more articles about PHP configuration background logon and template introduction, refer to PHP Chinese network!

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.