我正在尝试使用指向控制器的路由文件创建一个新模块。但是我的日志中出现以下错误
ReflectionException: Class \Drupal\glue\Controller\GlueController does not exist in ReflectionMethod->__construct() (line 128 of /home/vagrant/Projects/neut-business-website/core/lib/Drupal/Core/Entity/EntityResolverManager.php).
胶水.routing.yml:
hello_world:
path: '/hello-world'
defaults:
_controller: '\Drupal\glue\Controller\GlueController::helloWorldPage'
requirements:
_permission: 'access content'
带以下控制器
project_folder/modules/glue/src/Controller/GlueController
<?php
namespace Drupal\glue\Controller;
class GlueController {
public function hellowWorldPage() {
return [
'#markup' => t('<p>Hello world</p>')
];
}
}