I have a file called Query.php.
namespace Test
{
class Query
{
public function __construct()
{
printf("Hello, World");
}
}
}
in bootstrap.php I try to call it:
spl_autoload_register(function($className) {
if(file_exists('../folder/'.$className.'.php'))
{
require_once '../folder/'.$className.'.php';
}
});
new \Test\Query();
Result: Fatal error: class Test\Query not found.
Without namespace it works fine. How to fix it?
Thanks in advance.