Skip to content

Commit 86ac3a4

Browse files
authored
升级到 v4.5.5 (#167)
1 parent f626823 commit 86ac3a4

File tree

26 files changed

+328
-107
lines changed

26 files changed

+328
-107
lines changed

source/changelogs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
.. toctree::
1313
:titlesonly:
1414

15+
v4.5.5
1516
v4.5.4
1617
v4.5.3
1718
v4.5.2

source/changelogs/v4.1.2.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
- 统一并弃用 ``ControllerResponse`` 和 ``FeatureResponse``,改用 ``TestResponse``。
5757
- 弃用 ``Time::instance()``,改用 ``Time::createFromInstance()`` (现在接受 ``DateTimeInterface``)。
5858
- 弃用 ``IncomingRequest::removeRelativeDirectory()``,改用 ``URI::removeDotSegments()``。
59-
- 弃用 ``\API\ResponseTrait::failValidationError``,改用 ``\API\ResponseTrait::failValidationErrors``。
59+
- 弃用 ``\API\ResponseTrait::failValidationError()``,改用 ``\API\ResponseTrait::failValidationErrors()``。
6060

6161
错误修复
6262
----------

source/changelogs/v4.5.5.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#############
2+
版本 4.5.5
3+
#############
4+
5+
发布日期:2024 年 9 月 7 日
6+
7+
**CodeIgniter4 的 4.5.5 版本发布**
8+
9+
.. contents::
10+
:local:
11+
:depth: 3
12+
13+
**********
14+
修复的错误
15+
**********
16+
17+
- **URL 辅助函数:** 修复了 :php:func:`auto_link()` 中正则表达式过时的错误。通过此修复,现在使用与 CodeIgniter 3 相同的正则表达式。
18+
19+
请参阅仓库的
20+
`CHANGELOG.md <https://github.com/codeigniter4/CodeIgniter4/blob/develop/CHANGELOG.md>`_
21+
以获取修复错误的完整列表。

source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
version = '4.5'
2727

2828
# The full version, including alpha/beta/rc tags.
29-
release = '4.5.4'
29+
release = '4.5.5'
3030

3131
# -- General configuration ---------------------------------------------------
3232

source/helpers/html_helper.rst

Lines changed: 49 additions & 48 deletions
Large diffs are not rendered by default.

source/helpers/text_helper.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110

111111
.. note:: 出于历史原因,此函数也接受并处理字符串输入。但是,这使它只是一个 ``stripslashes()`` 的别名。
112112

113-
.. php:function:: reduce_multiples($str[, $character = ''[, $trim = false]])
113+
.. php:function:: reduce_multiples($str[, $character = ','[, $trim = false]])
114114
115115
:param string $str: 要搜索的文本
116116
:param string $character: 要缩减的字符
@@ -122,7 +122,7 @@
122122

123123
.. literalinclude:: text_helper/009.php
124124

125-
如果第三个参数设置为 true,则会移除字符串开头和结尾处的字符出现。示例:
125+
如果第三个参数设置为 ``true``,它将移除字符串开头和结尾处出现的字符。例如:
126126

127127
.. literalinclude:: text_helper/010.php
128128

source/helpers/text_helper/009.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?php
22

33
$string = 'Fred, Bill,, Joe, Jimmy';
4-
$string = reduce_multiples($string, ','); // results in "Fred, Bill, Joe, Jimmy"
4+
$string = reduce_multiples($string); // results in "Fred, Bill, Joe, Jimmy"

source/helpers/text_helper/010.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?php
22

33
$string = ',Fred, Bill,, Joe, Jimmy,';
4-
$string = reduce_multiples($string, ', ', true); // results in "Fred, Bill, Joe, Jimmy"
4+
$string = reduce_multiples($string, ',', true); // results in "Fred, Bill, Joe, Jimmy"

source/incoming/routing.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -983,3 +983,31 @@ spark 路由
983983
.. code-block:: console
984984
985985
php spark routes --host accounts.example.com
986+
987+
获取路由信息
988+
***************************
989+
990+
在 CodeIgniter 4 中,理解和管理路由信息对于有效处理 HTTP 请求至关重要。这涉及到检索有关活动控制器和方法的详细信息,以及应用于特定路由的过滤器。下面,我们探讨如何访问这些路由信息,以帮助完成诸如日志记录、调试或实现条件逻辑等任务。
991+
992+
检索当前控制器/方法名称
993+
==============================================
994+
995+
在某些情况下,你可能需要确定当前 HTTP 请求触发了哪个控制器和方法。这对于日志记录、调试或基于活动控制器方法的条件逻辑非常有用。
996+
997+
CodeIgniter 4 提供了一种简单的方法来使用 ``Router`` 类访问当前路由的控制器和方法名称。以下是一个示例:
998+
999+
.. literalinclude:: routing/071.php
1000+
1001+
当你需要动态地与控制器交互或记录处理特定请求的方法时,这个功能特别有用。
1002+
1003+
获取当前路由的活动过滤器
1004+
============================================
1005+
1006+
:doc:`过滤器 <filters>` 是一个强大的功能,使你能够在处理 HTTP 请求之前或之后执行诸如身份验证、日志记录和安全检查等操作。要访问特定路由的活动过滤器,你可以使用 ``Router`` 类中的 :php:meth:`CodeIgniter\\Router\\Router::getFilters()` 方法。
1007+
1008+
此方法返回当前正在处理的路由的活动过滤器列表:
1009+
1010+
.. literalinclude:: routing/072.php
1011+
1012+
.. note:: ``getFilters()`` 方法仅返回为特定路由定义的过滤器。
1013+
它不包括全局过滤器或在 **app/Config/Filters.php** 文件中指定的过滤器。

source/incoming/routing/071.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
// Get the router instance.
4+
/** @var \CodeIgniter\Router\Router $router */
5+
$router = service('router');
6+
7+
// Retrieve the fully qualified class name of the controller handling the current request.
8+
$controller = $router->controllerName();
9+
10+
// Retrieve the method name being executed in the controller for the current request.
11+
$method = $router->methodName();
12+
13+
echo 'Current Controller: ' . $controller . '<br>';
14+
echo 'Current Method: ' . $method;

0 commit comments

Comments
 (0)