解决thinkPHP3.2.3使用Smarty模板后无法使用系统常量问题

https://blog.csdn.net/u014520745/article/details/52029411

 

 

在ThinkPHP/Library/Think/View.class.php 输出模板内容之前,加上字符替换行为,即在:第130附近的fetch() 方法中修改:

修改前:


// 获取并清空缓存
$content = ob_get_clean();
// 内容过滤标签
Hook::listen('view_filter',$content);
// 输出模板文件
return $content;

修改后:

// 获取并清空缓存
$content = ob_get_clean();
// 内容过滤标签
Hook::listen('view_filter',$content);
//修改
Hook::listen('template_filter',$content);
// 输出模板文件
return $content;

然后就可以使用系统的一些定义好的常量了

<h1>__PUBLIC__</h1>
<h1>__URL__</h1>

---------------------

thinkphp3.2使用smarty模板success及error跳转页面找不到的问题

https://www.cnblogs.com/anxiaoyu/p/6897550.html

 http://www.bubuko.com/infodetail-2134665.html

thinkphp3.2使用分页

https://www.cnblogs.com/tianguook/p/4326613.html

posted on 2019-03-15 20:49  防空洞123  阅读(162)  评论(0编辑  收藏  举报

导航