Php connects to the sftp server to download all files in the folder

excuse me, how does php connect to the sftp server to download all the files in the folder? I only see that php provides the function to download a single file, or how to traverse the directory of the folder under the sftp server?

Php
Mar.13,2021

according to your problem description, you seem to want to scan the folder through php, and then download the files in the folder one by one.

//php
//
scandir
//
is_dir

my implementation code

function do_search($path,$result){
        $dir = scandir($path);
        foreach ($dir as $key => $value) {
                if ($value!='.'&&$value!='..') {
                        //is dir
                        if (is_dir($path.'/'.$value)) {
                                $folder_info['folder'][]=$path.$value.'/';
                                $result = do_search($path.$value.'/',$result);
                        }
                        //not dir
                        else{
                                array_push($result,$path.$value);
                        }
                }
        }
        //$folder_info"" 
        //return $folder_info;
        //$result"" 
        return $result;
}

//$result
$result =array();

//$pathlinux/var/www/html/
$all_file_info = do_search($path,$result);
//$all_file_infodo_searchnot dir
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e40653-448bb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e40653-448bb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?