这段代码:
<?PHP namespace designblob; function autoloader($class){ include "wrappers/databaseWrapper.PHP"; } spl_autoload_register('autoloader'); ?>
抛出此错误:
Fatal error: Uncaught exception ‘LogicException’ with message ‘Function ‘autoloader’ not found (function ‘autoloader’ not found or invalid function name)’ in /var/www/xxx/library/autoloader.PHP:8 Stack trace: #0 /var/www/xxx/library/autoloader.PHP(8): spl_autoload_register(‘autoloader’) #1 /var/www/xxx/library/debug.PHP(19): require_once(‘/var/www/xxx…’) #2 {main} thrown in /var/www/xxxm/library/autoloader.PHP on line 8
为什么不起作用?
spl_autoload_register('designblob\autoloader');