Skip to content

Commit d7db4eb

Browse files
author
dogstar
committed
fixed array_multisort Array to string conversion
1 parent da2c0af commit d7db4eb

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

vendor/phalapi/kernal/src/Helper/ApiList.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ public function render($tplPath = NULL) {
193193
if ($this->apiListSortBy == self::API_LIST_SORT_BY_API_TITLE) {
194194
// 根据自定义接口标题排序
195195
$sortTiles = array_column($subAllApiS, 'title');
196-
array_multisort($subAllApiS, SORT_ASC, SORT_STRING, $sortTiles);
196+
// @link https://www.php.net/manual/zh/function.array-multisort.php 示例 #4
197+
array_multisort($sortTiles, SORT_ASC, SORT_STRING, $subAllApiS);
197198
} else {
198199
// 默认根据接口名称排序
199200
ksort($subAllApiS);
@@ -203,7 +204,7 @@ public function render($tplPath = NULL) {
203204
foreach ($subAllApiS as &$subMethods) {
204205
if ($this->apiListSortBy == self::API_LIST_SORT_BY_API_TITLE) {
205206
$subSortTitles = array_column($subMethods['methods'], 'title');
206-
array_multisort($subMethods['methods'], SORT_ASC, SORT_STRING, $subSortTitles);
207+
array_multisort($subSortTitles, SORT_ASC, SORT_STRING, $subMethods['methods']);
207208
} else {
208209
ksort($subMethods);
209210
}

0 commit comments

Comments
 (0)