Hallo,
ich habe habe mir einen kleinen Autoloader gebastelt. Allerdings funktioniert der nicht, obwohl die Daten vorhanden sind.
Was ist an dem Code falsch?
Folgende Fehlermeldung:
Warning: include(app\App.php): failed to open stream: No such file or directory in /......./index.php on line 4
Warning: include(): Failed opening 'app\App.php' for inclusion (include_path='.:/Applications/MAMP/bin/php/php5.5.18/lib/php') in /......../index.php on line 4
Fatal error: Class 'app\App' not found in /........./index.php on line 9
ich habe habe mir einen kleinen Autoloader gebastelt. Allerdings funktioniert der nicht, obwohl die Daten vorhanden sind.
Was ist an dem Code falsch?
Code:
<?php function autoloader($class) { include $class . '.php'; } spl_autoload_register('autoloader'); $app = new \app\App(); $app->init();
Warning: include(app\App.php): failed to open stream: No such file or directory in /......./index.php on line 4
Warning: include(): Failed opening 'app\App.php' for inclusion (include_path='.:/Applications/MAMP/bin/php/php5.5.18/lib/php') in /......../index.php on line 4
Fatal error: Class 'app\App' not found in /........./index.php on line 9
Kommentar