Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Błąd Using $this when not in object context
Forum PHP.pl > Forum > PHP > Object-oriented programming
amii
Mam skrypt w którym korzystam z gotowej klasy HTTP_Request kawałek kodu z pliku index.php
Wyskakuje mi taki błąd:
Fatal error: Using $this when not in object context in /home/mylogin/domains/strona.pl/public_html/login/index.php on line 13
Klasa korzysta jeszcze z 3 innych plików:
  1. /**
  2.  * PEAR and PEAR_Error classes (for error handling)
  3.  */
  4. require_once 'PEAR.php';
  5. /**
  6.  * Socket class
  7.  */
  8. require_once 'Net/Socket.php';
  9. /**
  10.  * URL handling class
  11.  */
  12. require_once 'Net/URL2.php';


  1. $this->sock =& new HTTP_Request(); //line 13
  2. $this->sock->_allowRedirects = true;
  3. $this->sock->clearCookies();
  4. $this->sock->setURL($url);
  5. $this->sock->setMethod('GET');
  6. $this->sock->sendRequest();
skowron-line
Nie możesz po za klasą używać słówka $this.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2024 Invision Power Services, Inc.