DemoController.php 744 B

123456789101112131415161718192021222324252627
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Controller;
  4. use Hyperf\HttpServer\Annotation\Controller;
  5. use Hyperf\HttpServer\Annotation\GetMapping;
  6. use Hyperf\View\RenderInterface;
  7. #[Controller(prefix: "/demo")]
  8. class DemoController
  9. {
  10. #[GetMapping(path: "smarty")]
  11. public function smartyDemo(RenderInterface $render)
  12. {
  13. return $render->render('demo', [
  14. 'title' => 'Hyperf + Smarty 演示',
  15. 'now' => time(),
  16. 'show_extra' => true,
  17. 'items' => [
  18. '框架' => 'Hyperf ' . hyperf_version(),
  19. 'PHP版本' => PHP_VERSION,
  20. '模板引擎' => 'Smarty ' . \Smarty::SMARTY_VERSION,
  21. ],
  22. ]);
  23. }
  24. }