问题
I'm trying to execute a php script with ajax but I get this error Fatal error: Class 'backoffice\controllers\TypesManager' not found
although I used namespace.
This is the php file that I called it from ajax function:
namespace backoffice\controllers;
use backoffice\controllers\TypesManager;
$tm = new TypesManager();
echo $tm->getAllTypes();
And this is the my TypesManager
class:
namespace backoffice\controllers;
/**
* TypesManager
*/
class TypesManager{
function __construct(){
}
public function getAllTypes(){
echo 'Display all types.';
}
}
Both classes are under this path: backoffice/controller.
What am I missing here ?
来源:https://stackoverflow.com/questions/35268022/php-class-not-found-even-with-using-namespace