ibibicloud/think-template

Maintainers

Package info

github.com/ibibicloud/think-template

pkg:composer/ibibicloud/think-template

Transparency log

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

8.0.0 2026-07-23 21:02 UTC

This package is auto-updated.

Last update: 2026-07-23 21:04:41 UTC


README

基于版本 https://github.com/top-think/think-template/tree/v3.0.2

文档地址 https://doc.thinkphp.cn/@think-template/default.html

安装

composer require ibibicloud/think-template

用法示例

<?php
namespace think;

require __DIR__.'/vendor/autoload.php';

// 设置模板引擎参数
$config = [
	'view_path'	  => './template/',
	'cache_path'  => './runtime/',
	'view_suffix' => 'html',
];

$template = new Template($config);
// 模板变量赋值
$template->assign(['name' => 'think']);
// 读取模板文件渲染输出
$template->fetch('index');
// 完整模板文件渲染
$template->fetch('./template/test.php');
// 渲染内容输出
$template->display($content);

支持静态调用

use think\facade\Template;

Template::config([
	'view_path'	  => './template/',
	'cache_path'  => './runtime/',
	'view_suffix' => 'html',
]);
Template::assign(['name' => 'think']);
Template::fetch('index',['name' => 'think']);
Template::display($content,['name' => 'think']);