标签:turn view middle html end admin token this sources
视图的模板都是放在 resources/views 下面
在 resources/views 新键一个文件夹 admin 在这文件夹新键一个模板 admin.blade.php
模板的后辍 blade.php
文件: resources/views/admin/admin.blade.php
<html>
<body>
<h1>Hello, {{ $name }}</h1>
</body>
</html>
控制器:app/http/Controllers/admin/AdminController.php
<?php namespace App\Http\Controllers\admin; use App\User; use App\Http\Controllers\Controller; class AdminController extends Controller { public function __construct() { //$this->middleware(‘auth‘)->except(‘login‘); } public function login() { } public function index() { return view(‘admin.admin‘)->with(‘name‘,‘world‘); } }
在控制器 返回 视图 view(‘路径’)->with(‘key‘,‘name‘);
admin.admin 就是 admin/admin 完整就是 resources/views/admin/admin.blade.php
标签:turn view middle html end admin token this sources
原文地址:http://www.cnblogs.com/yeyuansheng/p/7190470.html