控制器 controller

robots.php

  1. public function index()
  2. {
  3. $site_robots = "*";
  4. $this->assign('site_robots', $site_robots);
  5. return response($this->fetch(), 200, ['content-type' => '']);
  6. }

HTML页面

robots.html

  1. {$site_robots}

路由 route

route.php

  1. /* robots.txt */
  2. 'robots' => ['robots/index', ['method' => 'get', 'ext' => 'txt']],