ftp_site

(PHP 3 >= 3.0.15, PHP 4, PHP 5)

ftp_site -- 向伺服器傳送 SITE 指令

說明

bool ftp_site ( resource ftp_stream, string cmd )

ftp_site() 函數向 FTP 伺服器傳送由參數 cmd 特殊的指令。SITE 指令是非標準化的,不同的伺服器不盡相同。主要用於處理檔案權限以及組成員等事情。

例子 1. 向一個 FTP 伺服器傳送一條 SITE 指令

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

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

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

若果成功則返回 TRUE,失敗則返回 FALSE

參見 ftp_raw()