diff --git a/reference/calendar/functions/easter-date.xml b/reference/calendar/functions/easter-date.xml index 87a829c6b..f942bfb90 100644 --- a/reference/calendar/functions/easter-date.xml +++ b/reference/calendar/functions/easter-date.xml @@ -1,6 +1,6 @@ - + easter_date @@ -17,11 +17,6 @@ 返回指定年份的复活节午夜时的 Unix 时间戳。 - - - 如果指定的年份超出 Unix 时间戳(即通常在 32 位系统上指定 1970 年以前或 2037 年以后)的范围,该函数将生成一个警告。 - - 复活节的日期是由尼西亚议会在公元 325 年确定的为每年春分月圆后的第一个星期日。春分一般是在 3 月 21 日,这就简化为只要计算满月的日期和紧挨的星期日的日期。这里所用的算法是在 532 年由 Dionysius Exiguus @@ -39,8 +34,8 @@ year - 1970 年至 2037 年之间的数字类型的年份。如果省略或者为 - &null;,则根据本地时间默认为当前年份。 + 对于 32 位系统,年份必须是 1970 至 2037 之间的数字,对于 64 位系统,年份必须是 1970 到 2,000,000,000 + 之间的数字。如果省略或者为 &null;,则根据本地时间默认为当前年份。 @@ -64,6 +59,14 @@ + + &reftitle.errors; + + 如果年份早于 1970,或者晚于 32 位系统的 2037 以及 64 位系统上的 2,000,000,000 + 时会抛出 ValueError。 + + + &reftitle.changelog; @@ -75,12 +78,25 @@ + + 8.3.0 + + 在 64 位系统上,year 参数现在接受范围在 1970 到 2,000,000,000 的值。 + + 8.0.0 year 现在可为空(nullable)。 + + 8.0.0 + + 当 year 超出允许的范围现在抛出 ValueError。之前函数会返回 + &false; 会触发 E_WARNING。 + + @@ -99,6 +115,24 @@ echo date("M-d-Y", easter_date(1999)); // Apr-04-1999 echo date("M-d-Y", easter_date(2000)); // Apr-23-2000 echo date("M-d-Y", easter_date(2001)); // Apr-15-2001 +?> +]]> + + + + + 使用带 <classname>DateTime</classname> 的 <function>easter_date</function> + +setTimestamp($timestamp); + +echo $datetime->format('M-d-Y'); // Apr-09-2023 + ?> ]]> diff --git a/reference/hash/functions/hash-equals.xml b/reference/hash/functions/hash-equals.xml index ae3c66c0d..41b373646 100644 --- a/reference/hash/functions/hash-equals.xml +++ b/reference/hash/functions/hash-equals.xml @@ -1,6 +1,6 @@ - + @@ -16,12 +16,17 @@ stringuser_string - 比较两个字符串,无论它们是否相等,本函数的时间消耗是恒定的。 + 检查两个字符串是否相等,而不会通过执行时泄露有关 known_string 内容的任何信息。 - 本函数可以用在需要防止时序攻击的字符串比较场景中, - 例如,可以用在比较 crypt 密码散列值的场景。 + 此函数可用于缓解计时攻击。使用 === 进行常规比较所需的时间的长短取决于两个值是否不同以及可以找到第一个不同的位置,从而泄露有关 + known_string 内容的秘密信息。 + + + 非常重要的一点是,用户提供的字符串必须是第二个参数。 + + @@ -31,7 +36,7 @@ known_string - 已知长度的、要参与比较的 string + 必须保密的已知 &string;。 @@ -39,7 +44,7 @@ user_string - 用户提供的字符串 + 与已知字符串进行比较的用户提供的 &string;。 @@ -61,20 +66,24 @@ ]]> &example.outputs; @@ -90,13 +99,16 @@ bool(false) 在时序攻击的场景下,已知字符串的长度可能会被泄露。 - - - 非常重要的一点是,用户提供的字符串必须是第二个参数。 - - + + &reftitle.seealso; + + + hash_hmac + + +