Exemplo n.º 1
0
 /**
  * 保存缓存
  * 如果页面内容小于1KB,则不被缓存即使满足缓存条件
  * @param string $html
  */
 public function save($html)
 {
     if (mb_strlen($html, 'UTF-8') > 1024 && $this->is_allow_cache()) {
         $file = $this->cache_file_path();
         $html = clean_htmlblank($html);
         $es = PHP_EOL . "<!--[[" . ENO_POWER . ' ' . ENO_AUTHOR . ' ' . get_format_time() . ' ' . $this->cache_file_rule() . time() . "]]-->";
         // 该值用以判断是否过期
         file_put_contents($file, $html . $es);
     }
 }
Exemplo n.º 2
0
 /**
  * 记录信息
  * @param mixed  $msg
  * @param string $tit
  * @param string $dir 记录所在文件夹
  *
  * @return
  */
 function log_msg($msg = '', $tit = '', $dir = 'def')
 {
     ob_start();
     var_dump($msg);
     $m = ob_get_contents();
     ob_end_clean();
     $path = mk_dir('./logs/' . $dir, 1);
     $file = date('Y-m-d') . '.log';
     $m = '【' . get_format_time() . '】' . $tit . PHP_EOL . $m . PHP_EOL . PHP_EOL;
     file_put_contents($path . $file, $m . PHP_EOL, FILE_APPEND);
 }