ITPub博客

首页 > IT职业 > IT图书 > Compiler.php

Compiler.php

IT图书 作者:tony0087 时间:2021-09-09 09:16:44 0 删除 编辑

 

namespace IlluminateViewCompilers;

 

use IlluminateFilesystemFilesystem;

 

abstract class Compiler

{// a abstract class

   

    protected $files;//The filesystem instance.

 

   

    protected $cachePath;//Get the cache path for the compiled views.

 

   

    public function __construct(Filesystem $files, $cachePath)

    {

        $this->files = $files;

        $this->cachePath = $cachePath;

    }//_construct

   // files

   // set some construct

 

   

    public function getCompiledPath($path)

    {

        return $this->cachePath.'/'.sha1($path).'.php';

    }// get The Compiled Path

 

   

    public function isExpired($path)

    {// check is expired

        $compiled = $this->getCompiledPath($path);// compiled

 

        // If the compiled file doesn't exist we will indicate that the view is expired

        // so that it can be re-compiled. Else, we will verify the last modification

        // of the views is less than the modification times of the compiled views.

        if (! $this->cachePath || ! $this->files->exists($compiled)) {

            return true;

        }// true

 

        $lastModified = $this->files->lastModified($path);

// last Modified

        return $lastModified >= $this->files->lastModified($compiled);

    }// has this result

}

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/1747/viewspace-2801689/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-09-06

  • 博文量
    233
  • 访问量
    9712