Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class GuestBook
- {
- public $path;
- protected $data;
- public function __construct($path)
- {
- $this->path = $path;
- $this->data = fopen($path, 'a');
- }
- public function getData() {
- return file($this->path, FILE_IGNORE_NEW_LINES);
- }
- public function append($text) {
- $array = $this->getData();
- $array[] = $text;
- return $array;
- }
- public function save() {
- file_put_contents($this->path, $this->append($text), FILE_APPEND);
- }
- }
Add Comment
Please, Sign In to add comment