Ver Mensaje Individual
  #5 (permalink)  
Antiguo 01/12/2011, 23:15
opzina2
 
Fecha de Ingreso: abril-2009
Mensajes: 46
Antigüedad: 15 años, 1 mes
Puntos: 1
Respuesta: Llamar o hacer referencia a una propiedad

Gracias, Dejo la ultima corrección por si a caso.

Código PHP:
Ver original
  1. <?php
  2. class file {
  3.  
  4.     private $root;
  5.     private $filename;
  6.    
  7.     public function __construct($ruta, $filename) {
  8.         $this->root = $ruta;
  9.         $this->filename = $this->root . "/" . $filename;
  10.     }
  11.    
  12.     public function read() {
  13.        
  14.         if (is_dir($this->root) && is_file($this->filename)) {
  15.             $lineas = file($this->filename);
  16.            
  17.             for($i = 0; $i < count($lineas); $i++) {
  18.                 $linea .= $lineas[$i] . "<br />";
  19.             }
  20.            
  21.             return $linea;
  22.         }
  23.        
  24.     }
  25.  
  26.     public function view() {
  27.         return $this->read();
  28.     }
  29.    
  30. }
  31. ?>