![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 42 Pomógł: 0 Dołączył: 5.11.2003 Ostrzeżenie: (0%) ![]() ![]() |
czesc
czy moglibyscie mi powiedziec dlaczego kod: [php:1:1e0113cc4a]<?php class test { function testing() { print "OLABOGA"; } } class nowa { function nic() { $test -> testing(); } } class engine { var $test; var $nowa; function engine() { $this -> test = new test; $this -> test -> testing(); $this -> nowa = new nowa; $this -> nowa -> nic(); } } $engine = new engine(); ?>[/php:1:1e0113cc4a] zwraca blad: Cytat Call to a member function on a non-object
(IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) ? Czy zawsze trzeba przekazywac obiekty przez tablice $_GLOBALS ? A moze jakos inaczej? Dzieki. |
|
|
![]()
Post
#2
|
|
Grupa: Przyjaciele php.pl Postów: 2 335 Pomógł: 6 Dołączył: 7.03.2002 Ostrzeżenie: (0%) ![]() ![]() |
[php:1:c0f4311a42]<?php
class test { function testing() { print "OLABOGA"; } } class nowa { var $test = null; function nic() { $this->test->testing(); // <---- } } class engine { var $test; var $nowa; function engine() { $this -> test = new test; $this -> test -> testing(); $this -> nowa = new nowa; $this->nowa->test =& $this->test; /// <---- tutaj przekazujemy obiekt przez ref. $this ->nowa -> nic(); } } $engine = new engine(); ?>[/php:1:c0f4311a42] |
|
|
![]()
Post
#3
|
|
Grupa: Zarejestrowani Postów: 42 Pomógł: 0 Dołączył: 5.11.2003 Ostrzeżenie: (0%) ![]() ![]() |
dzieki seth na tobie mozna polegac jak na zawiszy (IMG:http://forum.php.pl/style_emoticons/default/smile.gif) po 6 minutach dostalem odpowiedz (IMG:http://forum.php.pl/style_emoticons/default/smile.gif) ))
|
|
|
![]() ![]() |
![]() |
Aktualny czas: 24.08.2025 - 06:35 |