6-3.inc

来自「《php程序设计》的配套源码 《php程序设计》的配套源码 《php程序」· INC 代码 · 共 38 行

INC
38
字号
<?php
// this file is Log.inc

class Log {
  var $filename;
  var $fp;

  function Log($filename) {
    $this->filename = $filename;
    $this->open();
  }

  function open() {
    $this->fp = fopen($this->filename, "a")
                or die("Can't open {$this->filename}");
  }

  function write($note) {
    fwrite($this->fp, "$note\n");
  }

  function read() {
    return join('', file($this->filename));
  }

  function __wakeup() {
    $this->open();
  }

  function __sleep() {
    // write information to the account file
    fclose($this->fp);
    return array('filename');
  }

}
?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?