網(wǎng)站首頁 編程語言 正文
前提:首先要了解下如何自建composer包。
1.先建一個(gè)空包,加一個(gè)文件:composer.json
{
"name": "test/ctrs",
"type": "library",
"license": "MIT",
"autoload": {
"psr-4": {
"app\\controller\\ctrs\\": "src/"
}
}
}
?2.建一個(gè)源碼目錄src,在src下建相關(guān)文件:
?Test.php
<?php
namespace app\controller\ctrs;
use think\facade\View;
class Test
{
public function index()
{
// 設(shè)置視圖目錄
View::config(['view_path' => __DIR__ . '/view/']);
// View::config(['view_path' => 'D:\tmp\test\php\2\tp\vendor\test\ctrs\src\view/']);
return view('index', array('time' => time()));
}
}
布局文件:layout.html
<!DOCTYPE html>
<html>
<head>
<title>{block name="title"}默認(rèn)標(biāo)題{/block}</title>
</head>
<body>
<h1>layout!!</h1>
{block name="body"}body{/block}
</body>
</html>
視圖文件:
{extend name="layout" /}
{block name="title"}
頁面標(biāo)題
{/block}
{block name="body"}
<h2>Composer 包中的視圖!!</h2>
<div>
time:{$time}
</div>
{/block}
原文鏈接:https://blog.csdn.net/nece001/article/details/131449455
- 上一篇:沒有了
- 下一篇:沒有了
相關(guān)推薦
- 2022-12-05 關(guān)于Word2Vec可視化展示_python
- 2022-04-06 .Net使用加密升級(jí)數(shù)據(jù)安全_實(shí)用技巧
- 2022-08-24 C++中的Reactor原理與實(shí)現(xiàn)_C 語言
- 2022-08-29 .NET?Core項(xiàng)目使用swagger開發(fā)組件_實(shí)用技巧
- 2022-07-01 Python直接使用plot()函數(shù)畫圖的方法實(shí)例_python
- 2022-12-05 深入了解C++封閉類的定義與使用_C 語言
- 2022-02-27 Uncaught (in promise) Error: Redirected when going
- 2022-02-11 element ui table 內(nèi)嵌 input 調(diào)用 focus 方法無效
- 欄目分類
-
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細(xì)win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運(yùn)行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲(chǔ)小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運(yùn)算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認(rèn)證信息的處理
- Spring Security之認(rèn)證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯(cuò)誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實(shí)現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡(jiǎn)單動(dòng)態(tài)字符串(SD
- arthas操作spring被代理目標(biāo)對(duì)象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊(duì)列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠(yuǎn)程分支