Advertisement
SashaRaaa

Untitled

Jul 17th, 2018
611
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class GuestBook {
  2. protected $file = fopen ( $file, 'r' );
  3. protected $reviews = [];
  4.  
  5. public function __construct ($file) {
  6.    while ( !feof($this->file) ) {
  7.    $line = fgets($this->file, 1024);
  8.    $this->reviews[] = $line;
  9.  }
  10. }
  11.  
  12. public function getData() {
  13.    return $this->reviews;
  14. }
  15.  
  16. public function append($text) {
  17.    $this->reviews[] = $text;
  18. }
  19.  
  20. public function save() {
  21.    fwrite ($this->file, $this->review);  
  22.  }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement