Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> __autoload()
bela
post
Post #1


Administrator PHPedia.pl


Grupa: Developerzy
Postów: 1 102
Pomógł: 2
Dołączył: 14.09.2003

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


hmm, ostatnio zaczelem pisac Odina od poczatku i myslalem o __autload
  1. <?php
  2. Odin::import('net.odin-framework.Exceptions');
  3. Odin::import('net.odin-framework.Logger');
  4. Odin::import('net.odin-framework.SessionHandler');
  5. Odin::import('net.odin-framework.ConfigParser');
  6.  
  7. function __autoload ($sClassName) {
  8. Odin::import($sClassName);
  9. }
  10. class Odin {
  11. public function __construct () {
  12. Logger::addNote('Start Odina');
  13. $abv = new net.odin-framework.HttpRequest();
  14. Logger::addNote('Koniec pracy');
  15. }
  16.  
  17. public static function import ($sPackage) {
  18. if (preg_match('/([a-zA-Z0-9_-]+.{0,1})+/', $sPackage, $aMatches)) {
  19. $aPackages = explode('.', $sPackage);
  20. $sFile = str_replace('.', '/', $sPackage);
  21. $sFile = $sFile . '.php';
  22. if(file_exists($sFile)) {
  23. require_once($sFile);
  24. } else {
  25. throw new NoSuchFileException($sFile);
  26. }
  27. }
  28. }
  29. private function runAction ($sActionName) {
  30. try {
  31. } catch (FallBack $f) {
  32.  
  33. }
  34. }
  35. }
  36.  
  37. ?>


i probowalem wywolywać klasy przez $abc = new net.odin-framework.Abc, ale wywala blad
Kod
Fatal error:  Function __autoload(net) threw an exception of type 'NoSuchFileException' in c:\gry\miniserver\uniserver3_1\diskw\www\nOdin\net\odin-framework\Odin.php on line 15


czyli php nawet nie idzisz po sciezce dry.gif tylko uzywa samego net, moze ktos bawil sie w cos takiego samego biggrin.gif


--------------------
Go to the top of the page
+Quote Post

Posty w temacie


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 Aktualny czas: 22.08.2025 - 10:43