P粉8059312812023-08-14 16:48:10
Create an empty $files
array before the loop, then merge and return in each loop like below.
$files = []; $nextPageToken = "empty"; $optParams = array( 'fields' => "nextPageToken, files(contentHints/thumbnail,fileExtension,iconLink,id,name,size,thumbnailLink,webContentLink,webView Link,mimeType,parents)", 'pageToken' => $nextPageToken, 'orderBy' => 'modifiedTime desc, name' ); while ( $nextPageToken != null) { $responseFiles = $drive->ListFiles($optParams); $nextPageToken = $responseFiles->getNextPageToken(); $files = array_merge($files, $responseFiles->getFiles()); $optParams['q'] => "'".$match[0]."' in parents"; }
See array_merge’s API documentation for more information.