mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
Fixes #4409: Upper case letters in subdirectory prefixes of controller IDs were not properly handled
This commit is contained in:
@ -112,11 +112,13 @@ For this reason, controller IDs are often nouns referring to the types of the re
|
||||
For example, you may use `article` as the ID of a controller that handles article data.
|
||||
|
||||
By default, controller IDs should contain these characters only: English letters in lower case, digits,
|
||||
underscores, dashes and forward slashes. For example, `article`, `post-comment`, `admin/post2-comment` are
|
||||
all valid controller IDs, while `article?`, `PostComment`, `admin\post` are not.
|
||||
underscores, dashes and forward slashes. For example, `article` and `post-comment` are both valid controller IDs,
|
||||
while `article?`, `PostComment`, `admin\post` are not.
|
||||
|
||||
The dashes in a controller ID are used to separate words, while the forward slashes to organize controllers in
|
||||
sub-directories.
|
||||
A controller ID may also contain a subdirectory prefix. For example, `admin/article` stands for an `article` controller
|
||||
in the `admin` subdirectory under the [[yii\base\Application::controllerNamespace|controller namespace]].
|
||||
Valid characters for subdirectory prefixes include: English letters in lower and upper cases, digits, underscores and
|
||||
forward slashes, where forward slashes are used as separators for multi-level subdirectories (e.g. `panels/admin`).
|
||||
|
||||
|
||||
### Controller Class Naming <a name="controller-class-naming"></a>
|
||||
@ -134,7 +136,8 @@ takes the default value `app\controllers`:
|
||||
|
||||
* `article` derives `app\controllers\ArticleController`;
|
||||
* `post-comment` derives `app\controllers\PostCommentController`;
|
||||
* `admin/post2-comment` derives `app\controllers\admin\Post2CommentController`.
|
||||
* `admin/post-comment` derives `app\controllers\admin\PostCommentController`;
|
||||
* `adminPanels/post-comment` derives `app\controllers\adminPanels\PostCommentController`.
|
||||
|
||||
Controller classes must be [autoloadable](concept-autoloading.md). For this reason, in the above examples,
|
||||
the `article` controller class should be saved in the file whose [alias](concept-aliases.md)
|
||||
|
Reference in New Issue
Block a user