自动加载器预期类" Sdz \ BlogBundle \ Controller \ DefaultController"在文件" C:\ wamp64 \ www \ Symfony \ vendor \ composer /../../ src \ Sdz \ BlogBundle \ Controller \ DefaultController.php"中定义。找到该文件但该类不在其中,类名或命名空间可能有拼写错误。 500内部服务器错误 - RuntimeException
堆栈跟踪
in vendor\symfony\symfony\src\Symfony\Component\Debug\DebugClassLoader.php at line 223 -
throw new \RuntimeException(sprintf('Trying to autoload a class with an invalid name "%s". Be careful that the namespace separator is "\" in PHP, not "/".', $class));
}
throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file));
}
if (self::$caseCheck) {
$real = explode('\\', $class.strrchr($file, '.'));
答案 0 :(得分:1)
如果您的类名称与文件名不对应,则会发生此错误。
例如:
Sdz\BlogBundle\Controller\DefaultController.php
班级名称:
class UserController