使用thinkphp5在模闆頁面想動态引入不同的模闆,但是不能被正常解析,看了網上的幾種方法,隻能去修改原始方法檔案了,具體如下:
{include file=”$param/head”}
<include file="$template1" />
修改檔案
thinkphp\library\think\Template.php檔案下的parseInclude方法

添加的代碼
if(isset($array['append']) && $array['append']){
if(0===strpos($array['append'],'$')){
$array['append'] = $this->get(substr($array['append'],1));
}
$file = $array['append'].$array['file'];
unset($array['append']);
}else{
$file = $array['file'];
}