Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Problem z set_include_path, Automatyczne ładowanie klas
nesquik_
post 28.10.2014, 15:25:03
Post #1





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 28.02.2012

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


Witam.

Mam nadzieję, że piszę w dobrym dziale.
Mam taką strukturę plików:

  1. /app
  2. /controllers
  3. /libs
  4. /models
  5. /views
  6. /core
  7. /main
  8. registry.php
  9. /config
  10. /libs
  11. init.php
  12. index.php
  13. .htaccess
  14.  


Chodzi o to że w pliku init mam funkcje set_include_path oraz funkcje __autoload.
Plik init.php jest includowany do index.php
Jeśli w index.php chcę wywołać klasę registry (plik /core/registry.php) to dostaję błędy.

init.php
  1.  
  2. if(!isset($_SESSION)){session_start();}
  3.  
  4.  
  5.  
  6. set_include_path(get_include_path() . PATH_SEPARATOR . '/core/main');
  7. set_include_path(get_include_path() . PATH_SEPARATOR . '/core/libs');
  8. set_include_path(get_include_path() . PATH_SEPARATOR . '/core/config');
  9. set_include_path(get_include_path() . PATH_SEPARATOR . '/app/controllers');
  10. set_include_path(get_include_path() . PATH_SEPARATOR . '/app/views');
  11. set_include_path(get_include_path() . PATH_SEPARATOR . '/app/models');
  12. set_include_path(get_include_path() . PATH_SEPARATOR . '/app/libs');
  13.  
  14. function __autoload($name)
  15. {
  16. include_once($name.".php");
  17. }
  18.  
  19.  


index.php
  1. <?php
  2. include_once 'core/init.php';
  3. $router = registry::register('router');


błędy:

.;C:\xampp\php\PEAR
Warning: include_once(registry.php): failed to open stream: No such file or directory in C:\xampp\htdocs\wildcms\core\init.php on line 19

Warning: include_once(): Failed opening 'registry.php' for inclusion (include_path='.;C:\xampp\php\PEAR;/core/main;/core/libs;/core/config;/app/controllers;/app/views;/app/models;/app/libs') in C:\xampp\htdocs\wildcms\core\init.php on line 19

Fatal error: Class 'registry' not found in C:\xampp\htdocs\wildcms\index.php on line 3

Próbowałem już na innych serwerach(wamp, xamp)
Go to the top of the page
+Quote Post

Posty w temacie
- nesquik_   Problem z set_include_path   28.10.2014, 15:25:03
- - Pyton_000   Poczytaj o PSR-0 i PSR-4   28.10.2014, 15:47:15
- - nesquik_   No poczytałem i nie bardzo rozumiem co mam złe?   29.10.2014, 14:15:15
- - redeemer   Kodinclude_path='.;C:\xampp\php...   29.10.2014, 14:21:29
- - nesquik_   Nie mam pojęcia.   30.10.2014, 07:46:15
- - nospor   /app/views; Czy Twoja aplikacja naprawdę leży w GŁ...   30.10.2014, 07:51:54


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: 19.07.2025 - 04:43