html.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /**
  3. * 易优CMS
  4. * ============================================================================
  5. * 版权所有 2016-2028 海南赞赞网络科技有限公司,并保留所有权利。
  6. * 网站地址: http://www.eyoucms.com
  7. * ----------------------------------------------------------------------------
  8. * 如果商业用途务必到官方购买正版授权, 以免引起不必要的法律纠纷.
  9. * ============================================================================
  10. * Author: 小虎哥 <1105415366@qq.com>
  11. * Date: 2018-4-3
  12. */
  13. $html_cache_arr = array();
  14. // 全局变量数组
  15. $global = config('tpcache');
  16. empty($global) && $global = tpCache('global');
  17. // 系统模式
  18. $web_cmsmode = isset($global['web_cmsmode']) ? $global['web_cmsmode'] : 2;
  19. /*页面缓存有效期*/
  20. $app_debug = true;
  21. $web_htmlcache_expires_in = -1;
  22. if (1 == $web_cmsmode) { // 运营模式
  23. $app_debug = false;
  24. $web_htmlcache_expires_in = isset($global['web_htmlcache_expires_in']) ? $global['web_htmlcache_expires_in'] : 7200;
  25. }
  26. /*--end*/
  27. /*缓存的页面*/
  28. $html_cache_arr = array();
  29. /*--end*/
  30. /*引入全部插件的页面缓存规则*/
  31. $weappRow = \think\Db::name('weapp')->field('code')->where([
  32. 'status' => 1,
  33. ])->cache(true, null, "weapp")->select();
  34. foreach ($weappRow as $key => $val) {
  35. $file = WEAPP_DIR_NAME.DS.$val['code'].DS.'html.php';
  36. if (file_exists($file)) {
  37. $html_value = include_once $file;
  38. if (empty($html_value)) {
  39. continue;
  40. }
  41. foreach ($html_value as $k => $v) {
  42. if (!empty($v) && is_array($v)) {
  43. $v = array_merge($v, array('cache'=>$web_htmlcache_expires_in));
  44. $html_value[$k] = $v;
  45. }
  46. }
  47. $html_cache_arr = array_merge($html_value, $html_cache_arr);
  48. }
  49. }
  50. /*--end*/
  51. return array(
  52. // 应用调试模式
  53. 'app_debug' => $app_debug,
  54. // 模板设置
  55. 'template' => array(
  56. // 模板路径
  57. 'view_path' => './template/plugins/',
  58. // 模板后缀
  59. 'view_suffix' => 'htm',
  60. // 模板引擎禁用函数
  61. 'tpl_deny_func_list' => 'eval,echo,exit',
  62. // 默认模板引擎是否禁用PHP原生代码 苦恼啊! 鉴于百度统计使用原生php,这里暂时无法开启
  63. 'tpl_deny_php' => false,
  64. ),
  65. // 视图输出字符串内容替换
  66. 'view_replace_str' => array(
  67. '__EVAL__' => '', // 过滤模板里的eval函数,防止被注入
  68. ),
  69. /**假设这个访问地址是 www.xxxxx.dev/home/goods/goodsInfo/id/1.html
  70. *就保存名字为 index_goods_goodsinfo_1.html
  71. *配置成这样, 指定 模块 控制器 方法名 参数名
  72. */
  73. 'HTML_CACHE_ARR'=> $html_cache_arr,
  74. );
  75. ?>