Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
media-resource
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨昕
media-resource
Commits
ef3726d4
Commit
ef3726d4
authored
Jan 07, 2021
by
杨昕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
生成唯一编号
parent
7e84d396
Pipeline
#13147
passed with stages
in 44 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletions
+4
-1
functions.php
app/Helpers/functions.php
+4
-1
No files found.
app/Helpers/functions.php
View file @
ef3726d4
...
@@ -297,6 +297,8 @@ function generateRandomNum( $len = 32, $md5 = true ) {
...
@@ -297,6 +297,8 @@ function generateRandomNum( $len = 32, $md5 = true ) {
# Create random token at the specified length
# Create random token at the specified length
for
(
$i
=
0
;
$i
<
$len
;
$i
++
)
for
(
$i
=
0
;
$i
<
$len
;
$i
++
)
$token
.=
$chars
[
mt_rand
(
0
,
$numChars
)
];
$token
.=
$chars
[
mt_rand
(
0
,
$numChars
)
];
$time
=
microtime
(
true
);
# Should token be run through md5?
# Should token be run through md5?
if
(
$md5
)
{
if
(
$md5
)
{
# Number of 32 char chunks
# Number of 32 char chunks
...
@@ -305,8 +307,9 @@ function generateRandomNum( $len = 32, $md5 = true ) {
...
@@ -305,8 +307,9 @@ function generateRandomNum( $len = 32, $md5 = true ) {
for
(
$i
=
1
;
$i
<=
$chunks
;
$i
++
)
for
(
$i
=
1
;
$i
<=
$chunks
;
$i
++
)
$md5token
.=
md5
(
substr
(
$token
,
$i
*
32
-
32
,
32
)
);
$md5token
.=
md5
(
substr
(
$token
,
$i
*
32
-
32
,
32
)
);
# Trim the token
# Trim the token
$token
=
substr
(
$md5token
,
0
,
$len
);
$token
=
md5
(
$time
.
substr
(
$md5token
,
0
,
$len
)
);
}
}
return
$token
;
return
$token
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment