PHP spl_autoload_register () does not find function

This code:

<?php namespace designblob; function autoloader($class){ include "wrappers/databaseWrapper.php"; } spl_autoload_register('autoloader'); ?> 

causes this error:

Fatal error: throw a "LogicException" exception with the message "Autoloader function not found (autoloader function 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 at /var/www/xxxm/library/autoloader.php on line 8

Why doesn't it work?

+7
source share
1 answer
 spl_autoload_register('designblob\autoloader'); 
+12
source

All Articles