Skip to content

Commit aba7d00

Browse files
committed
更新README.md
1 parent a4eead9 commit aba7d00

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ echo id_decode('m_Dl9'); //包含无效字符,抛出错误
3636
echo id_decode('nlK8GhRW'); //校验错误,抛出错误
3737

3838
```
39+
[hashids/hashids](https://github.com/ivanakimov/hashids.php)不同的是`hashids`提供多个数字或包含多个数字的数组加密成一个字符串,
40+
解密时以数组形式返回,这在实际应用中并不常见,反而给使用带来一定麻烦,
41+
而此包对此进行了一些处理,不提供多个数字或多个数字数组的加密,解密时直接返回解密后的数字。
42+
3943
## Laravel深度应用
4044
### 加密
4145
有2种方法实现自动加密

src/helpers.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
use Hashids\Hashids;
44

55
if (! function_exists('id_encode')) {
6+
67
/**
7-
* 加密正整数
8-
*
98
* @param $int
10-
* @return string | null
9+
* @return string
10+
* @throws HashidException
1111
*/
1212
function id_encode($int)
1313
{
@@ -20,11 +20,11 @@ function id_encode($int)
2020
}
2121

2222
if (! function_exists('id_decode')) {
23+
2324
/**
24-
* 对加密后的字符串解密
25-
*
2625
* @param $str
27-
* @return Number | null
26+
* @return integer
27+
* @throws HashidException
2828
*/
2929
function id_decode($str)
3030
{

0 commit comments

Comments
 (0)