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
209da1be
Commit
209da1be
authored
May 20, 2020
by
王源
🎧
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加空字符转null方法
parent
986b2f8e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
1 deletion
+24
-1
functions.php
src/functions.php
+24
-1
No files found.
src/functions.php
View file @
209da1be
...
...
@@ -7,7 +7,6 @@ use Hyperf\Redis\Redis;
use
Hyperf\Utils\ApplicationContext
;
use
Psr\EventDispatcher\EventDispatcherInterface
;
/**
* 容器实例
*/
...
...
@@ -414,3 +413,27 @@ if (!function_exists('get_week_start_and_end')) {
return
array
(
"week_start"
=>
$week_start
,
"week_end"
=>
$week_end
);
}
}
if
(
!
function_exists
(
'empty_string_2_null'
))
{
/**
* 空字符串转NULL
* @param array $arr
* @return array
*/
function
empty_string_2_null
(
array
$arr
)
{
if
(
!
empty
(
$arr
))
{
foreach
(
$arr
as
$key
=>
$value
)
{
if
(
is_array
(
$value
))
{
$arr
[
$key
]
=
empty_string_2_null
(
$value
);
}
else
{
if
(
$value
===
''
)
{
$arr
[
$key
]
=
null
;
}
}
}
}
return
$arr
;
}
}
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