Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
meibuyu-micro
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
without authentication
meibuyu-micro
Commits
ea523045
Commit
ea523045
authored
Apr 27, 2020
by
王源
🎧
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化文件大小转化方法
parent
fa6370a1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
functions.php
src/functions.php
+6
-3
No files found.
src/functions.php
View file @
ea523045
...
@@ -380,17 +380,20 @@ if (!function_exists('num_2_file_size')) {
...
@@ -380,17 +380,20 @@ if (!function_exists('num_2_file_size')) {
function
num_2_file_size
(
$num
)
function
num_2_file_size
(
$num
)
{
{
$p
=
0
;
$p
=
0
;
$format
=
'
K
B'
;
$format
=
'B'
;
if
(
$num
>
0
&&
$num
<
1024
)
{
if
(
$num
>
0
&&
$num
<
1024
)
{
return
number_format
(
$num
)
.
' '
.
$format
;
return
number_format
(
$num
)
.
' '
.
$format
;
}
else
if
(
$num
>=
1024
&&
$num
<
pow
(
1024
,
2
))
{
}
else
if
(
$num
>=
1024
&&
$num
<
pow
(
1024
,
2
))
{
$p
=
1
;
$p
=
1
;
$format
=
'
M
B'
;
$format
=
'
K
B'
;
}
else
if
(
$num
>=
pow
(
1024
,
2
)
&&
$num
<
pow
(
1024
,
3
))
{
}
else
if
(
$num
>=
pow
(
1024
,
2
)
&&
$num
<
pow
(
1024
,
3
))
{
$p
=
2
;
$p
=
2
;
$format
=
'
G
B'
;
$format
=
'
M
B'
;
}
else
if
(
$num
>=
pow
(
1024
,
3
)
&&
$num
<
pow
(
1024
,
4
))
{
}
else
if
(
$num
>=
pow
(
1024
,
3
)
&&
$num
<
pow
(
1024
,
4
))
{
$p
=
3
;
$p
=
3
;
$format
=
'GB'
;
}
else
if
(
$num
>=
pow
(
1024
,
4
)
&&
$num
<
pow
(
1024
,
5
))
{
$p
=
4
;
$format
=
'TB'
;
$format
=
'TB'
;
}
}
$num
/=
pow
(
1024
,
$p
);
$num
/=
pow
(
1024
,
$p
);
...
...
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