CLogFileHandler.php 470 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. /**
  3. * 配置账号信息
  4. */
  5. namespace common\library\Pay\lib;
  6. interface ILogHandler
  7. {
  8. public function write($msg);
  9. }
  10. class CLogFileHandler implements ILogHandler
  11. {
  12. private $handle = null;
  13. public function __construct($file = '')
  14. {
  15. $this->handle = fopen($file,'a');
  16. }
  17. public function write($msg)
  18. {
  19. fwrite($this->handle, $msg, 4096);
  20. }
  21. public function __destruct()
  22. {
  23. fclose($this->handle);
  24. }
  25. }