Skip to content

Commit 2946c4e

Browse files
committed
Update Utils.php
1 parent 2d9f1d3 commit 2946c4e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Utils.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ public static function showJson(int $code = 0, string $msg = "", $data = ""):Jso
3535
*/
3636
public function filterParamsField(array $data, $fields, string $type = "field"): array
3737
{
38-
if (!($fields && strpos($fields, ',') !== false)){
39-
return [];
38+
if ($fields && strpos($fields, ',') !== false){
39+
$fieldArr = explode(',', $fields);
40+
}else{
41+
$fieldArr = [$fields];
4042
}
41-
$fieldArr = explode(',', $fields);
43+
4244
$dataList = [];
4345
foreach ($data as $item) {
4446
if (!empty($item['name']) && in_array($item['name'], $fieldArr) && $type === 'field') {

0 commit comments

Comments
 (0)