extend/alipay/pay/lotusphp_runtime/MVC/TemplateView.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php
class LtTemplateView
{
	public $layout;
	public $layoutDir;

	public $template;
	public $templateDir;
	public $compiledDir;

	public $autoCompile; // bool
	public $component; // bool
	private $tpl_include_files;

	public function __construct()
	{
		/**
		 * 自动编译通过对比文件修改时间确定是否编译,
		 * 当禁止自动编译时, 需要手工删除编译后的文件来重新编译.
		 * 
		 * 支持component include自动编译
		 */
		$this->autoCompile = true;
		$this->component = false;
	}

	public function render()
	{
		if (empty($this->compiledDir))
		{
			$this->compiledDir = dirname($this->templateDir) . "/viewTpl/";
		}
		if (!empty($this->layout))
		{
			include $this->template(true);
		}
		else if ($this->component)
		{
			return; // 模板内使用{component module action}合并文件
		}
		else
		{
			include $this->template();
		}
	}

	/**
	 * 返回编译后的模板路径, 如果不存在则编译生成并返回路径. 
	 * 如果文件存在且允许自动编译, 则对比模板文件和编译后的文件修改时间 
	 * 当修改模板后自支重新编译
	 * 
	 * @param bool $islayout 是否使用布局
	 * @return string 返回编译后的模板路径
	 */
	public function template($islayout = false)
	{
		$this->layoutDir = rtrim($this->layoutDir, '\\/') . '/';
		$this->compiledDir = rtrim($this->compiledDir, '\\/') . '/';
		$this->templateDir = rtrim($this->templateDir, '\\/') . '/';

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。