array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'uk', ), 'this' => array ( 0 => 'function.ftp-site.php', 1 => 'ftp_site', 2 => 'Sends a SITE command to the server', ), 'up' => array ( 0 => 'ref.ftp.php', 1 => 'Функції FTP', ), 'prev' => array ( 0 => 'function.ftp-set-option.php', 1 => 'ftp_set_option', ), 'next' => array ( 0 => 'function.ftp-size.php', 1 => 'ftp_size', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/ftp/functions/ftp-site.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

ftp_site

(PHP 4, PHP 5, PHP 7, PHP 8)

ftp_siteSends a SITE command to the server

Опис

ftp_site(FTP\Connection $ftp, string $command): bool

ftp_site() sends the given SITE command to the FTP server.

SITE commands are not standardized, and vary from server to server. They are useful for handling such things as file permissions and group membership.

Параметри

ftp

Примірник FTP\Connection.

command

The SITE command. Note that this parameter isn't escaped so there may be some issues with filenames containing spaces and other characters.

Значення, що повертаються

Повертає true у разі успіху або false в разі помилки.

Журнал змін

Версія Опис
8.1.0 Тепер параметр ftp має бути примірником FTP\Connection. Раніше очікувався resource.

Приклади

Приклад #1 Sending a SITE command to an ftp server

<?php
// Connect to FTP server
$ftp = ftp_connect('ftp.example.com');
if (!
$ftp) die('Unable to connect to ftp.example.com');

// Login as "user" with password "pass"
if (!ftp_login($ftp, 'user', 'pass')) die('Error logging into ftp.example.com');

// Issue: "SITE CHMOD 0600 /home/user/privatefile" command to ftp server
if (ftp_site($ftp, 'CHMOD 0600 /home/user/privatefile')) {
echo
"Command executed successfully.\n";
} else {
die(
'Command failed.');
}
?>

Прогляньте також