在ThinkPHP/Library/Think/View.class.php 输出模板内容之前,加上字符替换行为,即在:第130附近的fetch() 方法中修改: 修改前: [php] view plain copy // 获取并清空缓存 $content = ob_get_clean(); // 内容过滤标签 Hook::listen('view_filter',$content); // 输出模板文件 return $content; 修改后: [php] view plain copy // 获取并清空缓存 $content = ob_get_clean(); // 内容过滤标签 Hook::listen('view_filter',$content); //修改 Hook::listen('template_filter',$content); // 输出模板文件 return $content; 然后就可以使用系统的一些定义好的常量了 [html] view plain copy <h1>__PUBLIC__</h1> <h1>__URL__</h1>