From af3e433b00e7ce5478b177e1c91d282c187055f6 Mon Sep 17 00:00:00 2001 From: xiaoz Date: Fri, 22 Jun 2018 14:45:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api.php | 10 +++++++++- caches/index.html | 0 style.php | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 caches/index.html diff --git a/api.php b/api.php index d916ca5..51dbcd3 100644 --- a/api.php +++ b/api.php @@ -17,6 +17,14 @@ //对URL进行md5加密用于文件存储 $filename = md5($url); $filename = "caches/".$filename.".md"; + //获取文件修改时间 + @$ftime = filemtime($filename); + (int)@$ftime = date('YmdH',$ftime); + (int)$thetime = date('YmdH',time()); + + //计算时差 + $diff = $thetime - $ftime; + //获取样式 $style = $_GET['style']; //获取方法 @@ -33,7 +41,7 @@ } //如果文件存在 - if(is_file($filename)) { + if((is_file($filename)) && ($diff <= 1)) { $text = file_get_contents($filename); } //文件不存在 diff --git a/caches/index.html b/caches/index.html new file mode 100644 index 0000000..e69de29 diff --git a/style.php b/style.php index 53e18ab..731f2bb 100644 --- a/style.php +++ b/style.php @@ -40,5 +40,6 @@ } }); + \ No newline at end of file