vendor/topthink/framework/src/think/view/driver/Php.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace think\view\driver;
use RuntimeException;
use think\App;
use think\contract\TemplateHandlerInterface;
use think\helper\Str;
/**
* PHP原生模板驱动
*/
class Php implements TemplateHandlerInterface
{
protected $template;
protected $content;
protected $app;
// 模板引擎参数
protected $config = [
// 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法
'auto_rule' => 1,
// 视图目录名
'view_dir_name' => 'view',
// 应用模板路径
'view_path' => '',
// 模板文件后缀
'view_suffix' => 'php',
// 模板文件名分隔符
'view_depr' => DIRECTORY_SEPARATOR,
];
public function __construct(App $app, array $config = [])
{
$this->app = $app;
$this->config = array_merge($this->config, (array) $config);
}
/**
* 检测是否存在模板文件
* @access public
* @param string $template 模板文件或者模板规则
* @return bool
*/
public function exists(string $template): bool
{
if ('' == pathinfo($template, PATHINFO_EXTENSION)) {
// 获取模板文件名
$template = $this->parseTemplate($template);
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。