PageController.php 662 B

12345678910111213141516171819202122232425262728
  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: "page")]
  8. class PageController
  9. {
  10. // #[GetMapping(path: "home")]
  11. public function index(RenderInterface $render)
  12. {
  13. var_dump("======###");
  14. return $render->render('index', [
  15. 'title' => '页面标题',
  16. 'shared_data' => [
  17. 'app_name' => 'My App',
  18. 'current_year' => date('Y')
  19. ],
  20. // 其他页面特定变量...
  21. ]);
  22. }
  23. }