作者 lyh

gx

... ... @@ -83,30 +83,9 @@ class TranslateLogic extends BaseLogic
}
}
$data = $this->unique_multidimensional_array($data);
return $this->success($data);
}
/**
* @remark :多维数组去重
* @name :unique_multidimensional_array
* @author :lyh
* @method :post
* @time :2024/3/8 16:38
*/
public function unique_multidimensional_array($array) {
$tempArray = [];
$uniqueArray = [];
foreach ($array as $value) {
// 使用键作为临时数组的键,如果不存在则添加到去重后的数组中
$key = key($value);
if (!isset($tempArray[$key])) {
$tempArray[$key] = true;
$uniqueArray[] = $value;
}
}
return $uniqueArray;
}
/**
* @remark :获取图片列表
... ... @@ -207,6 +186,7 @@ class TranslateLogic extends BaseLogic
}
$need_tran[] = $description ? $description->attr['content'] : '';
$need_tran[] = $keywords ? $keywords->attr['content'] : '';
$need_tran = array_unique($need_tran);
return $need_tran;
}
... ...