Пример #1
0
 /**
  * 根据模板文件生成编译文件
  *
  * @param $file
  *
  * @return string
  */
 public function compile($file)
 {
     $file = $this->template($file);
     $compileFile = ROOT_PATH . '/storage/view/' . preg_replace('/[^\\w]/', '_', $file) . '_' . substr(md5($file), 0, 5) . '.php';
     $status = c('app.debug') || !is_file($compileFile) || filemtime($file) > filemtime($compileFile);
     if ($status) {
         Dir::create(dirname($compileFile));
         //执行文件编译
         $compile = new Compile($this);
         $content = $compile->run($file);
         file_put_contents($compileFile, $content);
     }
     return $compileFile;
 }
Пример #2
0
 /**
  * 验证编译文件
  * @return [type] [description]
  */
 private function compileFile()
 {
     $status = !DEBUG && file_exists($this->compile) && filemtime($this->compile) > filemtime($this->tpl);
     if (!$status) {
         //执行文件编译
         $compile = new Compile($this);
         $content = $compile->run();
         file_put_contents($this->compile, $content);
     }
 }
Пример #3
0
 private function compileFile()
 {
     $status = !DEBUG && file_exists($this->compile) && filemtime($this->compile) > filemtime($this->tpl);
     if (!$status) {
         //创建编译目录
         $dir = dirname($this->compile);
         if (!is_dir($dir)) {
             mkdir($dir, 0755, true);
         }
         //执行文件编译
         $compile = new Compile($this);
         $content = $compile->run();
         file_put_contents($this->compile, $content);
     }
 }
Пример #4
0
 private function compileFile()
 {
     $status = Config::get('app.debug') || !file_exists($this->compile) || !is_file($this->compile) || filemtime($this->tpl) > filemtime($this->compile);
     if ($status) {
         //创建编译目录
         $dir = dirname($this->compile);
         if (!is_dir($dir)) {
             mkdir($dir, 0755, TRUE);
         }
         //执行文件编译
         $compile = new Compile($this);
         $content = $compile->run();
         file_put_contents($this->compile, $content);
     }
 }