Основной сайт хуманэмулятор.рф  |  Демо  |  Купить  |  API  |  Wiki



Web / ftp



list_folders

list_folders($server,$folder=""); - Получить список папок в папке на FTP сервере

Функция на вход принимает параметры:

  • $server – адрес FTP сервера
  • $folder – относительный путь к папке FTP

    После выполнения функции возвращаемое значение будет равно одному из двух :
  • результат – массив имен
  • пусто / null – ошибка

    Пример использования
    <?php
    // Scenario: List folders in a directory on FTP server
    
    $xhe_host = getenv("RPABOT_HOST_URL");
    if (!isset($path)){
        // Path to the init.php file for connecting to the XHE API
        $path = "../../../Templates/init.php";
        // Including init.php grants access to all classes and functionality for working with the XHE API
        require($path);
    }
    
    // Beginning
    echo "\n<font color=blue>ftp->".basename (__FILE__)."</font>\n";
    
    // FTP account
    $ftp_server = "ftp://127.0.0.1";
    $login = "test";
    $password = "test";
    $port = "";
    $is_passive = true;
    $timeout = 3;
    $encoding = "";
    
    // Step: Connect to FTP server
    echo "1. Connect to FTP server: ".$ftp_server." : ";
    echo WEB::$ftp->connect($ftp_server, $login, $password, $port,  $is_passive, $timeout, $encoding) . "\n";
    
    // Example 1: Get list of folders in root directory on FTP server
    $directoryPath = ".";
    echo "\n\nExample 1: Get list of folders in root directory on FTP server: \n";
    var_export(WEB::$ftp->list_folders($ftp_server, $directoryPath));
    
    // Step: Disconnect from all FTP servers
    echo "2. Disconnect from all FTP servers: ";
    echo WEB::$ftp->disconnect_all();
    
    // End
    echo "\n";
    
    // Quit
    WINDOW::$app->quit();
    ?>

    =============================================
    Ftp    Объекты    DOM  System  Vision  Web  Window        
    =============================================
    если что-то непонятно или необходимо узнать или считаете что надо добавить по работе этой функции, пишите в комментарии или на наш форум
    .