article_agreement.auto_cache.php 959 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. class article_agreement_auto_cache extends auto_cache{
  3. private $key = "article:agreement";
  4. public function load($param)
  5. {
  6. $content = $GLOBALS['cache']->get($this->key);
  7. if($content === false)
  8. {
  9. $sql = "select a.id,a.title,a.cate_id,a.content from ".DB_PREFIX."article a left join ".DB_PREFIX."article_cate b on b.id = a.cate_id where a.is_delete = 0 and a.is_effect = 1 and b.title = '主播协议'";
  10. $article = $GLOBALS['db']->getRow($sql,true,true);
  11. //$content = '<title>'.$article['title'].'</title>';
  12. //$content = $content.$article['content'];
  13. $content = file_get_contents(SITE_DOMAIN.APP_ROOT."/wap/index.php?ctl=settings&act=article_show&cate_id=".$article['cate_id']);
  14. $GLOBALS['cache']->set($this->key,$content);
  15. }
  16. return $content;
  17. }
  18. public function rm($param)
  19. {
  20. $GLOBALS['cache']->rm($this->key);
  21. }
  22. public function clear_all()
  23. {
  24. $GLOBALS['cache']->rm($this->key);
  25. }
  26. }
  27. ?>