当前位置:网站首页>Use of ThinkPHP template
Use of ThinkPHP template
2022-07-05 17:11:00 【qq_ forty-two million three hundred and seven thousand five hun】
thinkphp The template file of is placed in /home/View The template file here needs to be consistent with the name of the controller
For example, in view Create a new one in the directory Index Directory so Index The controller will call the template file of this directory
newly build Index The directory is being created index.html The contents are as follows 
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> Scorpio </title>
</head>
<body>
<p>helloworld</p>
</body>
</html>
rewrite IndexController.class.php Of index Method
<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
public function index(){
$this->display();
}
?>
display Method is used to call the access of template file index.php/home/index/index You can access Index Under the table of contents index.html Templates
Can be in display Add parameters to specify the template file to be accessed
<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
public function index(){
$this->display();
}
public function test(){
$this->display("index");;
}
}
When we visit index.php/home/index/test In fact, what I visited was index.html Template because we are display It specifies
Template commonly used static variables
PUBLIC It stands for /Public This directory is used to store css js Style file
/home/view/Index/index.html
<!doctype html>
<html>
<head>
<meta charset="UTF-8"/>
<title> Simple general article system background management template </title>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/common.css"/>
<link rel="stylesheet" type="text/css" href="__PUBLIC__ /css/main.css"/>
</head>
<body>
<div class="topbar-wrap white">
<div class="topbar-inner clearfix">
<div class="topbar-logo-wrap clearfix">
<h1 class="topbar-logo none"><a href="index.html" class="navbar-brand"> Background management </a></h1>
<ul class="navbar-list clearfix">
<li><a class="on" href="index.html"> home page </a></li>
<li><a href="#" target="_blank"> homepage </a></li>
</ul>
</div>
<div class="top-info-wrap">
<ul class="top-info-list clearfix">
<li><a href="#"> Administrators </a></li>
<li><a href="#"> Change Password </a></li>
<li><a href="#"> sign out </a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="sidebar-wrap">
<div class="sidebar-title">
<h1> menu </h1>
</div>
<div class="sidebar-content">
<ul class="sidebar-list">
<li>
<a href="#"><i class="icon-font"></i> Common operations </a>
<ul class="sub-menu">
<li><a href="design.html"><i class="icon-font"></i> Work management </a></li>
<li><a href="design.html"><i class="icon-font"></i> Blog management </a></li>
<li><a href="design.html"><i class="icon-font"></i> Classification management </a></li>
<li><a href="design.html"><i class="icon-font"></i> message management </a></li>
<li><a href="design.html"><i class="icon-font"></i> Comment management </a></li>
<li><a href="design.html"><i class="icon-font"></i> link </a></li>
<li><a href="design.html"><i class="icon-font"></i> Advertising management </a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-font"></i> System management </a>
<ul class="sub-menu">
<li><a href="system.html"><i class="icon-font"></i> System settings </a></li>
<li><a href="system.html"><i class="icon-font"></i> Clean cache </a></li>
<li><a href="system.html"><i class="icon-font"></i> The data backup </a></li>
<li><a href="system.html"><i class="icon-font"></i> Data restore </a></li>
</ul>
</li>
</ul>
</div>
</div>
<!--/sidebar-->
<div class="main-wrap">
<div class="crumb-wrap">
<div class="crumb-list"><i class="icon-font"></i><span> Welcome to use 『 Passion 』 Blog program , The preferred tool for Jianbo .</span></div>
</div>
<div class="result-wrap">
<div class="result-title">
<h1> shortcuts </h1>
</div>
<div class="result-content">
<div class="short-wrap">
<a href="insert.html"><i class="icon-font"></i> New works </a>
<a href="insert.html"><i class="icon-font"></i> The new post </a>
<a href="insert.html"><i class="icon-font"></i> New work categories </a>
<a href="insert.html"><i class="icon-font"></i> New blog category </a>
<a href="#"><i class="icon-font"></i> Work review </a>
</div>
</div>
</div>
<div class="result-wrap">
<div class="result-title">
<h1> System basic information </h1>
</div>
<div class="result-content">
<ul class="sys-info-list">
<li>
<label class="res-lab"> operating system </label><span class="res-info">WINNT</span>
</li>
<li>
<label class="res-lab"> Running environment </label><span class="res-info">Apache/2.2.21 (Win64) PHP/5.3.10</span>
</li>
<li>
<label class="res-lab">PHP Operation mode </label><span class="res-info">apache2handler</span>
</li>
<li>
<label class="res-lab"> Design quietly - edition </label><span class="res-info">v-0.1</span>
</li>
<li>
<label class="res-lab"> Upload attachment restrictions </label><span class="res-info">2M</span>
</li>
<li>
<label class="res-lab"> Beijing time. </label><span class="res-info">2014 year 3 month 18 Japan 21:08:24</span>
</li>
<li>
<label class="res-lab"> Server domain name /IP</label><span class="res-info">localhost [ 127.0.0.1 ]</span>
</li>
<li>
<label class="res-lab">Host</label><span class="res-info">127.0.0.1</span>
</li>
</ul>
</div>
</div>
<div class="result-wrap">
<div class="result-title">
<h1> Use the help </h1>
</div>
<div class="result-content">
<ul class="sys-info-list">
<li>
<label class="res-lab"> More templates :</label><span class="res-info"><a href="http://www.codejie.net/" target="_blank"> Source street - Free source download </a></span>
</li>
</ul>
</div>
</div>
</div>
<!--/main-->
</div>
</body>
</html>
Create a header template in view Create under directory comm The directory is creating head.html
/home/view/comm/head.html
<!doctype html>
<html>
<head>
<meta charset="UTF-8"/>
<title> Background management </title>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/common.css"/>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/main.css"/>
</head>
<body>
<div class="topbar-wrap white">
<div class="topbar-inner clearfix">
<div class="topbar-logo-wrap clearfix">
<h1 class="topbar-logo none"><a href="index.html" class="navbar-brand"> Background management </a></h1>
<ul class="navbar-list clearfix">
<li><a class="on" href="index.html"> home page </a></li>
<li><a href="#" target="_blank"> homepage </a></li>
</ul>
</div>
<div class="top-info-wrap">
<ul class="top-info-list clearfix">
<li><a href="#"> Administrators </a></li>
<li><a href="#"> Change Password </a></li>
<li><a href="#"> sign out </a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="sidebar-wrap">
<div class="sidebar-title">
<h1> menu </h1>
</div>
<div class="sidebar-content">
<ul class="sidebar-list">
<li>
<a href="#"><i class="icon-font"></i> Common operations </a>
<ul class="sub-menu">
<li><a href="design.html"><i class="icon-font"></i> Work management </a></li>
<li><a href="design.html"><i class="icon-font"></i> Blog management </a></li>
<li><a href="design.html"><i class="icon-font"></i> Classification management </a></li>
<li><a href="design.html"><i class="icon-font"></i> message management </a></li>
<li><a href="design.html"><i class="icon-font"></i> Comment management </a></li>
<li><a href="design.html"><i class="icon-font"></i> link </a></li>
<li><a href="design.html"><i class="icon-font"></i> Advertising management </a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-font"></i> System management </a>
<ul class="sub-menu">
<li><a href="system.html"><i class="icon-font"></i> System settings </a></li>
<li><a href="system.html"><i class="icon-font"></i> Clean cache </a></li>
<li><a href="system.html"><i class="icon-font"></i> The data backup </a></li>
<li><a href="system.html"><i class="icon-font"></i> Data restore </a></li>
</ul>
</li>
</ul>
</div>
</div>
stay /home/view/index.html This header template is directly included in
<include file="comm/head" />
<!--/sidebar-->
<div class="main-wrap">
<div class="crumb-wrap">
<div class="crumb-list"><i class="icon-font"></i><span> Welcome to use 『 Passion 』 Blog program , The preferred tool for Jianbo .</span></div>
</div>
<div class="result-wrap">
<div class="result-title">
<h1> shortcuts </h1>
</div>
<div class="result-content">
<div class="short-wrap">
<a href="insert.html"><i class="icon-font"></i> New works </a>
<a href="insert.html"><i class="icon-font"></i> The new post </a>
<a href="insert.html"><i class="icon-font"></i> New work categories </a>
<a href="insert.html"><i class="icon-font"></i> New blog category </a>
<a href="#"><i class="icon-font"></i> Work review </a>
</div>
</div>
</div>
<div class="result-wrap">
<div class="result-title">
<h1> System basic information </h1>
</div>
<div class="result-content">
<ul class="sys-info-list">
<li>
<label class="res-lab"> operating system </label><span class="res-info">WINNT</span>
</li>
<li>
<label class="res-lab"> Running environment </label><span class="res-info">Apache/2.2.21 (Win64) PHP/5.3.10</span>
</li>
<li>
<label class="res-lab">PHP Operation mode </label><span class="res-info">apache2handler</span>
</li>
<li>
<label class="res-lab"> Design quietly - edition </label><span class="res-info">v-0.1</span>
</li>
<li>
<label class="res-lab"> Upload attachment restrictions </label><span class="res-info">2M</span>
</li>
<li>
<label class="res-lab"> Beijing time. </label><span class="res-info">2014 year 3 month 18 Japan 21:08:24</span>
</li>
<li>
<label class="res-lab"> Server domain name /IP</label><span class="res-info">localhost [ 127.0.0.1 ]</span>
</li>
<li>
<label class="res-lab">Host</label><span class="res-info">127.0.0.1</span>
</li>
</ul>
</div>
</div>
<div class="result-wrap">
<div class="result-title">
<h1> Use the help </h1>
</div>
<div class="result-content">
<ul class="sys-info-list">
<li>
<label class="res-lab"> More templates :</label><span class="res-info"><a href="http://www.codejie.net/" target="_blank"> Source street - Free source download </a></span>
</li>
</ul>
</div>
</div>
</div>
<!--/main-->
</div>
</body>
</html>
/home/view/comm/insert.html
<include file="comm/head" />
<!--/sidebar-->
<div class="main-wrap">
<div class="crumb-wrap">
<div class="crumb-list"><i class="icon-font"></i><a href="/jscss/admin/design/"> home page </a><span class="crumb-step">></span><a class="crumb-name" href="/jscss/admin/design/"> Work management </a><span class="crumb-step">></span><span> New works </span></div>
</div>
<div class="result-wrap">
<div class="result-content">
<form action="/jscss/admin/design/add" method="post" id="myform" name="myform" enctype="multipart/form-data">
<table class="insert-tab" width="100%">
<tbody><tr>
<th width="120"><i class="require-red">*</i> classification :</th>
<td>
<select name="colId" id="catid" class="required">
<option value=""> Please select </option>
<option value="19"> Boutique interface </option><option value="20"> Recommendation interface </option>
</select>
</td>
</tr>
<tr>
<th><i class="require-red">*</i> title :</th>
<td>
<input class="common-text required" id="title" name="title" size="50" value="" type="text">
</td>
</tr>
<tr>
<th> author :</th>
<td><input class="common-text" name="author" size="50" value="admin" type="text"></td>
</tr>
<tr>
<th><i class="require-red">*</i> thumbnail :</th>
<td><input name="smallimg" id="" type="file"><!--<input type="submit" onclick="submitForm('/jscss/admin/design/upload')" value=" To upload pictures "/>--></td>
</tr>
<tr>
<th> Content :</th>
<td><textarea name="content" class="common-textarea" id="content" cols="30" style="width: 98%;" rows="10"></textarea></td>
</tr>
<tr>
<th></th>
<td>
<input class="btn btn-primary btn6 mr10" value=" Submit " type="submit">
<input class="btn btn6" onClick="history.go(-1)" value=" return " type="button">
</td>
</tr>
</tbody></table>
</form>
</div>
</div>
</div>
<!--/main-->
</div>
</body>
</html>
边栏推荐
- Embedded-c Language-1
- High number | summary of calculation methods of volume of rotating body, double integral calculation of volume of rotating body
- C#实现水晶报表绑定数据并实现打印3-二维码条形码
- First day of learning C language
- [Web attack and Defense] WAF detection technology map
- NPM installation
- Rider 设置选中单词侧边高亮,去除警告建议高亮
- CMake教程Step3(添加库的使用要求)
- The survey shows that the failure rate of traditional data security tools in the face of blackmail software attacks is as high as 60%
- C#(Winform) 当前线程不在单线程单元中,因此无法实例化 ActiveX 控件
猜你喜欢

Judge whether a number is a prime number (prime number)
![[61dctf]fm](/img/22/3e4e3f1679a27d8b905684bb709905.png)
[61dctf]fm

thinkphp模板的使用

Embedded -arm (bare board development) -2

China Radio and television officially launched 5g services, and China Mobile quickly launched free services to retain users

Read the basic grammar of C language in one article

URP下Alpha从Gamma空间到Linner空间转换(二)——多Alpha贴图叠加

干货!半监督预训练对话模型 SPACE

CMake教程Step4(安装和测试)

精准防疫有“利器”| 芯讯通助力数字哨兵护航复市
随机推荐
Machine learning compilation lesson 2: tensor program abstraction
Iphone14 with pill screen may trigger a rush for Chinese consumers
How does the outer disk futures platform distinguish formal security?
Is it safe for qiniu business school to open a stock account? Is it reliable?
阈值同态加密在隐私计算中的应用:解读
Is it safe to open futures accounts online? Will there be more liars online? Doesn't feel very reliable?
Rider 设置选中单词侧边高亮,去除警告建议高亮
【729. 我的日程安排表 I】
2022 年 Q2 加密市场投融资报告:GameFi 成为投资关键词
【二叉树】根到叶路径上的不足节点
High number | summary of calculation methods of volume of rotating body, double integral calculation of volume of rotating body
C# TCP如何设置心跳数据包,才显得优雅呢?
Deeply cultivate 5g, and smart core continues to promote 5g applications
It is forbidden to copy content JS code on the website page
Embedded -arm (bare board development) -2
IDC报告:腾讯云数据库稳居关系型数据库市场TOP 2!
WR | 西湖大学鞠峰组揭示微塑料污染对人工湿地菌群与脱氮功能的影响
腾讯音乐上线新产品“曲易买”,提供音乐商用版权授权
通过proc接口调试内核代码
云安全日报220705:红帽PHP解释器发现执行任意代码漏洞,需要尽快升级