Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
meibuyu-rpc
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
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
without authentication
meibuyu-rpc
Commits
b6a8c609
Commit
b6a8c609
authored
Dec 17, 2020
by
王源
🎧
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加获取两个数组中key相同,value不同的数据
parent
8886172e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
2 deletions
+33
-2
functions.php
src/functions.php
+33
-2
No files found.
src/functions.php
View file @
b6a8c609
...
@@ -732,6 +732,37 @@ if (!function_exists('check_diff_val')) {
...
@@ -732,6 +732,37 @@ if (!function_exists('check_diff_val')) {
}
}
}
}
if
(
!
function_exists
(
'get_diff_val'
))
{
/**
* 获取两个数组中key相同,value不同的数据
* 返回后者的数据
* @param array $list1
* @param array $list2
* @param array $excludeKey 排除的key数组
* @return array
* @author Zero
*/
function
get_diff_val
(
array
$list1
,
array
$list2
,
array
$excludeKey
=
[])
{
$diff
=
[];
foreach
(
$list1
as
$key
=>
$val
)
{
if
(
!
in_array
(
$key
,
$excludeKey
))
{
if
(
isset
(
$list2
[
$key
])
&&
$list2
[
$key
]
!=
''
)
{
if
(
is_array
(
$val
))
{
$temp
=
get_diff_val
(
$val
,
$list2
[
$key
],
$excludeKey
);
!
empty
(
$temp
)
&&
$diff
[
$key
]
=
$temp
;
}
else
{
if
(
$list1
[
$key
]
!=
$list2
[
$key
])
{
$diff
[
$key
]
=
$list2
[
$key
];
}
}
}
}
}
return
$diff
;
}
}
if
(
!
function_exists
(
'to_camel_case'
))
{
if
(
!
function_exists
(
'to_camel_case'
))
{
/**
/**
* 下划线命名转驼峰命名
* 下划线命名转驼峰命名
...
@@ -810,7 +841,7 @@ if (!function_exists('get_images_url')) {
...
@@ -810,7 +841,7 @@ if (!function_exists('get_images_url')) {
*/
*/
function
get_images_url
(
$str
)
function
get_images_url
(
$str
)
{
{
preg_match
(
'/<img.+src=\"?(.+\.(jpg|gif|bmp|bnp|png))\"?.+>/i'
,
$str
,
$match
);
preg_match
(
'/<img.+src=\"?(.+\.(jpg|gif|bmp|bnp|png))\"?.+>/i'
,
$str
,
$match
);
return
$match
;
return
$match
;
}
}
}
}
...
...
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