Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Klasy w php.
IdeaProgram
post
Post #1





Grupa: Zarejestrowani
Postów: 18
Pomógł: 0
Dołączył: 3.03.2016

Ostrzeżenie: (0%)
-----


Witam, posiadam dwie klasy, DB i Player, w player w konstrukcie zrobilem laczenie z DB. W funkcji getPlayer w Player mam dane o uzytkowniku np. $this->id = $array['id']; teraz gdy zrobilem nowa funkcje pod funkcja getPlayer w tej samej klasie gdy odwoluje sie do id czyli $this->id nie pobiera mi juz tego id. Czy musze robic jakas specjalna publiczna funkcje lub cos innego abym mogl z tego korzystac?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
gorden
post
Post #2





Grupa: Zarejestrowani
Postów: 486
Pomógł: 101
Dołączył: 27.06.2010

Ostrzeżenie: (0%)
-----


Tak.
  1. class player {
  2.  
  3. //O TU:
  4. public $player;
  5.  
  6. //////////costamcostam
  7.  
  8. function setPlayer() {
  9. //costam
  10. $this->player = $array['id'];
  11. }
  12.  
  13.  
  14. function getPlayer() {
  15. return $this->player;
  16. }
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: 11.10.2025 - 20:51