对比了tp默认的模板,发现默认模板可以通过监听template_filter加载行为(ThinkPHP/Library/Behavior/ContentReplaceBehavior.class.php)的,而smarty无法加载,最后只好在ThinkPHP/Library/Think/View.class.php文件中的第132行,即:Hook::listen('view_filter',$content);的下一行,
加上:Hook::listen('template_filter',$content);
这样,smarty模板文件才可以调用内部的 __ROOT__、__URL__等变量。
按理,不该加在view.class.php中,但实在找不到好办法。
最佳答案