Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Nie wiidzi klasy
-Gość_Sopel-
post 10.02.2005, 15:09:42
Post #1





Goście







Mam plik index.php
Na poczatku jest
define('SERVER', 'http://localhost/Sklep');
include(SERVER."/modules/DataAccess/DataAccess.php");
i w nim sa klasy:
  • Module
  • XMLModule
  • XMLConfig
W pliku DataAccess.php jeswt klasa DataAccess

W pliku index.php wywoluje
$foo = new DataAccess...

Mi sie wydaje ze wszystko jest ok ale wyskakuje blad:

Fatal error: Class 'DataAccess' not found in c:\wamp\www\Sklep\index.php on line 87
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 13)
hwao
post 10.02.2005, 15:37:54
Post #2


Developer


Grupa: Moderatorzy
Postów: 2 844
Pomógł: 20
Dołączył: 25.11.2003
Skąd: Olkusz




  1. <?php
  2. define('SERVER', 'http://localhost/Sklep');
  3. include(SERVER.&#092;"/modules/DataAccess/DataAccess.php\"); 
  4. ?>

Nie wiem za co Ty sie wogule bierzesz...

Zle zalanczasz te pliki wogule....
Go to the top of the page
+Quote Post
-Gość_Sopel-
post 10.02.2005, 18:19:56
Post #3





Goście







a moglbys cos wiecej napisac? pewnie chodzi o include, tak?
jesli chodzi o sciezki to powinny sie zgadzac..
Go to the top of the page
+Quote Post
Vertical
post 10.02.2005, 18:27:59
Post #4





Grupa: Zarejestrowani
Postów: 848
Pomógł: 0
Dołączył: 7.07.2004
Skąd: Wrocław

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


Cytat
Zle zalanczasz te pliki wogule....

Pliki są akurat załączane poprawnie
Go to the top of the page
+Quote Post
-Gość_Sopel-
post 10.02.2005, 18:37:46
Post #5





Goście







plik index.php:
  1. <?php
  2.  
  3. define('SERVER', 'http://localhost/Sklep');
  4. require_once (SERVER.'/modules/DataAccess/DataAccess.php');
  5.  
  6. class Module {
  7. //funkcje i zmienne tej klasy
  8. }
  9.  
  10. class XMLModule {
  11. //funkcje i zmienne tej klasy
  12. }
  13.  
  14. class XMLConfig {
  15. //funkcje i zmienne tej klasy
  16. }
  17.  
  18. $cos = new DataAccess;// <---- tutaj pojawia sie blad...
  19. ?>

i plik DataAccess.php:
  1. <?php
  2.  
  3. define('SERVER', 'http://localhost/Sklep');
  4. require_once(SERVER.&#092;"/DB/DB.php\");
  5.  
  6. class DataAccess {
  7. //funkcje i zmienne tej klasy
  8. }
  9. ?>


czy ktos wie o co chodzi?
Go to the top of the page
+Quote Post
crash
post 10.02.2005, 18:40:20
Post #6





Grupa: Przyjaciele php.pl
Postów: 2 196
Pomógł: 2
Dołączył: 17.01.2004
Skąd: Sosnowiec

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


A tak w sumie to czy zaincludowanie strony (nie pliku) z deklaracją klasy zadziała tak samo jak dołączenie i wykonanie lokalnego pliku? Bo coś mi się nie wydaje. Spóbuj require_once("./DB/DB.php");


--------------------
Go to the top of the page
+Quote Post
-Gość_Sopel-
post 10.02.2005, 18:41:59
Post #7





Goście







no wlasnie z require_once jest to samo... kod powyzej
Go to the top of the page
+Quote Post
crash
post 10.02.2005, 18:48:20
Post #8





Grupa: Przyjaciele php.pl
Postów: 2 196
Pomógł: 2
Dołączył: 17.01.2004
Skąd: Sosnowiec

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


Ty cały czas includujesz http://localhost/Sklep/DB/DB.php a spróbuj z ./DB/DB.php


--------------------
Go to the top of the page
+Quote Post
-Gość_Sopel-
post 10.02.2005, 18:50:08
Post #9





Goście







wiem smile.gif ale nie o ta linijke chodzi.. chodzi o linie 19 z pliku index.php..
wywala blad ze nie ma takiej klasy sadsmiley02.gif
Go to the top of the page
+Quote Post
NuLL
post 10.02.2005, 18:58:03
Post #10





Grupa: Zarejestrowani
Postów: 2 262
Pomógł: 21
Dołączył: 3.05.2004
Skąd: Sopot, Krakow, W-wa

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


A czemu w pierwszym poście pisze, że błąd jest w 87 ?


--------------------
Javascript, Coffeescript, Node.js, Mongo, CouchDb, chmury, workery & inne bajery - zycie jest zbyt krotkie aby miec nudna prace :)
Go to the top of the page
+Quote Post
-Gość_Sopel-
post 10.02.2005, 18:59:42
Post #11





Goście







bo wywalilem definicje klas dla czytelnosci kodu
Go to the top of the page
+Quote Post
crash
post 10.02.2005, 19:09:15
Post #12





Grupa: Przyjaciele php.pl
Postów: 2 196
Pomógł: 2
Dołączył: 17.01.2004
Skąd: Sosnowiec

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


Powtórze ponownie: Zaincluduj definicje klas z plików, a nie przez URL tongue.gif


--------------------
Go to the top of the page
+Quote Post
dr_bonzo
post 10.02.2005, 19:15:24
Post #13





Grupa: Przyjaciele php.pl
Postów: 5 724
Pomógł: 259
Dołączył: 13.04.2004
Skąd: N/A

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


1. plik sie nie includuje -- jesli by sie zaincludowal to mialbys blad ponownej definicji stalej ( define(...))
2.
Cytat
If "URL fopen wrappers" are enabled in php (which they are in the default configuration), you can specify the file to be included using a URL

jesli masz "allow_url_fopen = Off" to nie zainludujesz pliku przez http://... , zrob tak jak juz pisali: lokalnie.


--------------------
Nie lubię jednorożców.
Go to the top of the page
+Quote Post
-Gość_Sopel-
post 10.02.2005, 19:51:36
Post #14





Goście







wielkie dzieki smile.gif zaczelo dzialac...
teraz sa zupeleni inne bledy biggrin.gif
Go to the top of the page
+Quote Post

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

 



RSS Wersja Lo-Fi Aktualny czas: 20.07.2025 - 02:14