视图与模板布局

Original 2018-12-29 14:50:07 159
abstract:<?php namespace app\index\controller; use think\facade\View; use think\Controller; class Index extends Controller { public function demo() {   
<?php
namespace app\index\controller;
use think\facade\View;
use think\Controller;

class Index extends Controller
{
	public function demo()
	{
	    $name = 'skywalker';
	    return view('demo',['name'=>$name]);
	}
	//模板赋值
	public function demo1()
	{
	    $this->view->name = 'skywalker';
	    return $this->view->fetch();
	}

{//基础模板}

{block name = "header"}

{include file="header文件路径"}

{/block}

{block name="footer"}

{include file="footer文件路径"}

{/block}

Correcting teacher:韦小宝Correction time:2018-12-29 15:18:28
Teacher's summary:写的还是很不错的!简洁!课后记得多研究研究!

Release Notes

Popular Entries