ci4

Форк
0
/
Routing.php 
140 строк · 3.6 Кб
1
<?php
2

3
/**
4
 * This file is part of CodeIgniter 4 framework.
5
 *
6
 * (c) CodeIgniter Foundation <admin@codeigniter.com>
7
 *
8
 * For the full copyright and license information, please view
9
 * the LICENSE file that was distributed with this source code.
10
 */
11

12
namespace Config;
13

14
use CodeIgniter\Config\Routing as BaseRouting;
15

16
/**
17
 * Routing configuration
18
 */
19
class Routing extends BaseRouting
20
{
21
    /**
22
     * For Defined Routes.
23
     * An array of files that contain route definitions.
24
     * Route files are read in order, with the first match
25
     * found taking precedence.
26
     *
27
     * Default: APPPATH . 'Config/Routes.php'
28
     *
29
     * @var list<string>
30
     */
31
    public array $routeFiles = [
32
        APPPATH . 'Config/Routes.php',
33
    ];
34

35
    /**
36
     * For Defined Routes and Auto Routing.
37
     * The default namespace to use for Controllers when no other
38
     * namespace has been specified.
39
     *
40
     * Default: 'App\Controllers'
41
     */
42
    public string $defaultNamespace = 'App\Controllers';
43

44
    /**
45
     * For Auto Routing.
46
     * The default controller to use when no other controller has been
47
     * specified.
48
     *
49
     * Default: 'Home'
50
     */
51
    public string $defaultController = 'Home';
52

53
    /**
54
     * For Defined Routes and Auto Routing.
55
     * The default method to call on the controller when no other
56
     * method has been set in the route.
57
     *
58
     * Default: 'index'
59
     */
60
    public string $defaultMethod = 'index';
61

62
    /**
63
     * For Auto Routing.
64
     * Whether to translate dashes in URIs for controller/method to underscores.
65
     * Primarily useful when using the auto-routing.
66
     *
67
     * Default: false
68
     */
69
    public bool $translateURIDashes = false;
70

71
    /**
72
     * Sets the class/method that should be called if routing doesn't
73
     * find a match. It can be the controller/method name like: Users::index
74
     *
75
     * This setting is passed to the Router class and handled there.
76
     *
77
     * If you want to use a closure, you will have to set it in the
78
     * routes file by calling:
79
     *
80
     * $routes->set404Override(function() {
81
     *    // Do something here
82
     * });
83
     *
84
     * Example:
85
     *  public $override404 = 'App\Errors::show404';
86
     */
87
    public ?string $override404 = null;
88

89
    /**
90
     * If TRUE, the system will attempt to match the URI against
91
     * Controllers by matching each segment against folders/files
92
     * in APPPATH/Controllers, when a match wasn't found against
93
     * defined routes.
94
     *
95
     * If FALSE, will stop searching and do NO automatic routing.
96
     */
97
    public bool $autoRoute = false;
98

99
    /**
100
     * For Defined Routes.
101
     * If TRUE, will enable the use of the 'prioritize' option
102
     * when defining routes.
103
     *
104
     * Default: false
105
     */
106
    public bool $prioritize = false;
107

108
    /**
109
     * For Defined Routes.
110
     * If TRUE, matched multiple URI segments will be passed as one parameter.
111
     *
112
     * Default: false
113
     */
114
    public bool $multipleSegmentsOneParam = false;
115

116
    /**
117
     * For Auto Routing (Improved).
118
     * Map of URI segments and namespaces.
119
     *
120
     * The key is the first URI segment. The value is the controller namespace.
121
     * E.g.,
122
     *   [
123
     *       'blog' => 'Acme\Blog\Controllers',
124
     *   ]
125
     *
126
     * @var array<string, string>
127
     */
128
    public array $moduleRoutes = [];
129

130
    /**
131
     * For Auto Routing (Improved).
132
     * Whether to translate dashes in URIs for controller/method to CamelCase.
133
     * E.g., blog-controller -> BlogController
134
     *
135
     * If you enable this, $translateURIDashes is ignored.
136
     *
137
     * Default: false
138
     */
139
    public bool $translateUriToCamelCase = false;
140
}
141

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.