WriteHtmlCacheBehavior.class.php 975 B

12345678910111213141516171819202122232425
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: liu21st <liu21st@gmail.com>
  10. // +----------------------------------------------------------------------
  11. namespace Behavior;
  12. use Think\Storage;
  13. /**
  14. * 系统行为扩展:静态缓存写入
  15. */
  16. class WriteHtmlCacheBehavior {
  17. // 行为扩展的执行入口必须是run
  18. public function run(&$content){
  19. if(C('HTML_CACHE_ON') && defined('HTML_FILE_NAME')) {
  20. //静态文件写入
  21. Storage::put(HTML_FILE_NAME , $content,'html');
  22. }
  23. }
  24. }