Esempio n. 1
0
 public static function updateSystemCache()
 {
     $setting_file = WEB_ROOT_DIR . self::$cache_file;
     //        FFile::rmDir(WEB_ROOT_DIR . 'data/system/');
     $t = new FTable('setting');
     $settings = $t->select();
     $setting_write = array();
     foreach ($settings as $row) {
         $setting_write[$row['setting_key']] = $row['setting_value'];
     }
     FFile::save($setting_file, "<?php\n" . 'return ' . var_export($setting_write, true) . ';');
     FCache::flush();
 }
Esempio n. 2
0
 /**
  * @param $tpl_file
  * @param string $save_file 保存目录,相对于data目录
  * @param bool $isSubTpl
  * @return string 模板文件主体
  * @internal param string $content 模板文件主体
  */
 public function compile($tpl_file, $save_file = "", $isSubTpl = false)
 {
     $content = file_get_contents($tpl_file);
     $compiled_content = $this->parse($content);
     $header_comment = "Create On##" . time() . "|Compiled from##" . $this->template_path . $this->template_name;
     $str = "<? if(!defined('FLIB')) exit('Access Denied'); global \$_F; ";
     if (!$isSubTpl) {
         $str .= "\$tpl_file_mtime = " . intval(filemtime($tpl_file)) . ";";
     }
     $str .= "/*{$header_comment}*/ ?>{$compiled_content}";
     if ($save_file) {
         FFile::save($save_file, $str);
     }
     return $str;
 }