💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
【Drupal简易模块hello】 hello.info.yml: ``` name: Hello type: module description: Hello demo module. core: 8.x ``` hello.routing.yml: ``` hello.url: path: '/say_hello' defaults: _title: 'Hello Title' _controller: '\Drupal\hello\Controller\HelloController::content' requirements: _permission: 'access content' ``` src/Controller/HelloController.php: ``` <?php /** * @file * Contains \Drupal\hello\Controller. */ namespace Drupal\hello\Controller; use Drupal\Core\Controller\ControllerBase; class HelloController extends ControllerBase { public function content() { return array( '#markup' => '' . t('Hello there!') . '', ); } } ``` 【有Configure和Permissions的Drupal简易模块demo】 hello.info.yml: ``` name: Hello type: module description: Hello demo module. configure: hello.url core: 8.x ``` hello.routing.yml: ``` hello.url: path: '/say_hello' defaults: _title: 'Hello Title' _controller: '\Drupal\hello\Controller\HelloController::content' requirements: _permission: 'access content' ``` hello.permissions.yml: ``` permission demo 1: title: 'permission demo 1' permission demo 2: title: 'permission demo 2' permission demo 3: title: 'permission demo 3' ``` src/Controller/HelloController.php: ``` <?php /** * @file * Contains \Drupal\hello\Controller. */ namespace Drupal\hello\Controller; use Drupal\Core\Controller\ControllerBase; class HelloController extends ControllerBase { public function content() { return array( '#markup' => '' . t('Hello there!') . '', ); } } ``` 123