亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

布局模板,模板繼承

原創(chuàng) 2019-02-18 00:12:47 291
摘要://控制器<?php namespace app\index\controller; use think\Controller; class Index extends Controller {   public function index()     {

eeeee.png


//控制器

<?php
namespace app\index\controller;
use think\Controller;
class Index extends Controller
{	
	  public function index()
    {
        //渲染視圖
        return $this->fetch();
    }   

    public function add(){

        //渲染視圖
        return $this->fetch();
    }
    
}

//模板部分

index.hml

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
	<title>無標(biāo)題</title>
	<style type="text/css">
		.main{
			width: 800px;
			height: 600px;
			background: black;
			margin: auto;
			text-align: center;
			line-height: 600px;
			color: red;
		}

	</style>
</head>
<body>
		<div class="main">這個是index.html</div>
		
</body>
</html>

//add.html

{extend name="common"/}

{//重新父模板}

{block name="common"}
	<div style="text-align: center;"> 主體部分</div>
{/block}

//common.html

{//頭部內(nèi)容}
{block name="header"}
	{include file="public/header"}
{/block}

{block name="main"} 主體部分{/block}

{block name="footer"}
	{include file="public/footer"}
{/block}


//layout.html

{include file="public/header"}
{__CONTENT__}
{include file="public/footer"}


批改老師:查無此人批改時間:2019-02-18 09:33:45
老師總結(jié):看的不是太明白。header,footer這兩個文件沒有列出來?怕你把html,head標(biāo)簽重復(fù)了。繼續(xù)加油。

發(fā)布手記

熱門詞條