(1) Under Project. Env is the file for the configuration database
Db_host=127.0.0.1db_database=blogdb_prefix=blog_db_username=rootdb_password=123.comg
Write to database server address, connected database name, table prefix, user name, password, respectively
Where the table prefix db_prefix field is not the default, you need to add the config/database.php
' 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 ' and ' utf8_unicode_ci ', ' prefix ' = env (' Db_prefix ', '), ' strict ' = false, ' engine ' = null, ],
(2) Verify success
Create a Controller
PHP Artisan Make:controller Indexcontroller
<?phpnamespace app\http\controllers;use illuminate\http\request;use app\http\requests;use Illuminate\Support\ Facades\db;class Indexcontroller extends controller{public Function index () { $pdo = db::connection ()->getpdo () ; DD ($PDO); }}
To add routing information:
Route::get ('/test ', ' indexcontroller@index ');
Validation results:
(3) Import the written template
Rename server.php to index.php, move public/.htaccess to the project directory, and index.php the same directory//At this time can not access through public, Access form 127.0.0.1
Put the template admin into the views directory
To add a route:
Route::get ('/admin/login ', ' admin\logincontroller@login ');
Modifying the Controller logincontroller.php
Public Function Login () {return view (' Admin.login ');}
Change views/admin/login.html to Login.blade.php
When visiting, notice whether the CSS file is loaded into the
<link rel= "stylesheet" href= "{{asset (' Resources/views/admin/style/css/ch-ui.admin.css ')}}" ><link rel= " Stylesheet "href=" {{asset (' Resources/views/admin/style/font/css/font-awesome.min.css ')}} ">
Results:
Note: The background template and the XAMPP installation package are in the following link:
Http://pan.baidu.com/s/1hs5Jass
The above is the whole content of this article, I hope that the content of this article on everyone's study or work can bring some help, but also hope to support topic.alibabacloud.com!