hyperf/config/routes.php

35 lines
974 B
PHP
Executable File

<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
//use Hyperf\HttpServer\Router\Router;
//Router::addRoute(['GET', 'POST', 'HEAD'], '/', 'App\Controller\IndexController@index');
//
//Router::get('/favicon.ico', function () {
// return '';
//});
$path = BASE_PATH . '/routes';
$dirs = scandir($path);
foreach ($dirs as $dir) {
if ($dir != '.' && $dir != '..') {
if (!is_dir($dir)) {
require_once $path . '/' . basename($dir);
} else {
$routeFilePath = $path . "/{$dir}";
$files = scandir($routeFilePath);
foreach ($files as $file) {
if ($file != '.' && $file != '..') {
require_once $routeFilePath . '/' . basename($file);
}
}
}
}
}