Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Fatal error: Cannot access private property
szczabik
post
Post #1





Grupa: Zarejestrowani
Postów: 226
Pomógł: 1
Dołączył: 13.05.2008

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


Witam zacząłem pisać classe
Napisałem taki kod

  1. class tag_news
  2. {
  3. private $html;
  4.  
  5. function menu()
  6. {
  7. $this->html .= "<table>";
  8. $this->html .= "<tr>";
  9. $this->html .= "<td><a href='add_tag.php'>Dodaj tag</a></td>";
  10. $this->html .= "</tr>";
  11. $this->html .= "<table/>\n";
  12. }
  13. }

I wywołuje to tak

  1. require_once 'tag_news.class.php';
  2. $tag = new tag_news();
  3. $tag->html->menu();

I wywala błąd
Kod
Fatal error: Cannot access private property tag_news::$html in C:\Program Files\WebServ\httpd-users\obiekt\tag_news.php on line 4

nie wiem czemu. Czy może mi ktoś pomóc co w tym kodzie jest źle ?

Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
nospor
post
Post #2





Grupa: Moderatorzy
Postów: 36 559
Pomógł: 6315
Dołączył: 27.12.2004




odpowiedzi masz w poprzednich postach pozostalych userow (IMG:style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post

Posty w temacie


Closed TopicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 5.10.2025 - 01:23