<?php
// ============================================================================
class template
{
public $v = array(); // 变量
public $html_dir = ''; // html文件夹
public $temp_dir = 'temp/'; // 生成的PHP文件存放目录
public $tags = array(); // 待处理的标签数组
public $tags_rp = array(); // 标签替换数组
public $html_con = ''; // html文件内容
public $suffix = 'php'; // php文件后缀
// 显示模板
function display($file='')
{
$html_file = $this->html_dir . $file . '.html';
if (!is_file($html_file)) exit('模板文件不存在!' . $file);
// 相应的PHP文件
$php_file = "{$this->temp_dir}$file.{$this->suffix}";
// php文件已存在
if (is_file($php_file))
{
$mtime_h = filemtime($html_file); // HTML文件修改时间
$mtime_p = filemtime($php_file); // PHP文件修改时间
//
thinkphp简单处理模板类的方法
最新推荐文章于 2025-07-12 11:09:21 发布
本文介绍了ThinkPHP框架中处理模板的一些基本方法,包括如何加载模板、变量赋值、模板布局以及使用内置函数等,旨在帮助开发者更高效地进行视图层的开发。

订阅专栏 解锁全文

412

被折叠的 条评论
为什么被折叠?



