Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Call to a member function
-chronos-
post
Post #1





Goście







Witajcie,
mam taki kod:
  1. function load() {
  2. require 'go.php';
  3. $go = new Go();
  4. }
  5. echo load();
  6. echo $go->start();



  1. class Go {
  2. function __construct() {
  3. echo 'Witaj w klasie GO! <br/>';
  4. }
  5.  
  6. public function start() {
  7. echo 'Metoda start';
  8. }
  9. }


jednak to nie mogę wywołać funkcji start,
Fatal error: Call to a member function start() on a non-object - to ta linia: echo $go->start();

Proszę o pomoc.
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 30.09.2025 - 08:42