PHP spl_autoload_register()找不到函数

前端之家收集整理的这篇文章主要介绍了PHP spl_autoload_register()找不到函数前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
这段代码
<?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');
原文链接:https://www.f2er.com/php/134378.html

猜你在找的PHP相关文章