(PHP 4, PHP 5, PHP 7)
ftp_site — 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟� SITE 锟斤拷锟斤拷
$ftp_stream
, string $cmd
) : bool
ftp_site() 锟斤拷锟斤拷锟斤拷 FTP 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟缴诧拷锟斤拷 cmd
指锟斤拷锟斤拷锟斤拷锟筋。
SITE 锟斤拷锟斤拷锟角非憋拷准锟斤拷锟侥o拷锟斤拷同锟侥凤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷同锟斤拷锟斤拷要锟斤拷锟节达拷锟斤拷锟侥硷拷权锟斤拷锟皆硷拷锟斤拷锟皆憋拷锟斤拷锟斤拷椤�
ftp_stream
FTP 锟斤拷锟斤拷锟斤拷源锟斤拷
command
SITE 锟斤拷锟筋。注锟解本锟斤拷锟斤拷没锟叫撅拷锟斤拷锟斤拷锟斤拷锟斤拷锟侥硷拷锟斤拷锟叫达拷锟节空革拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷址锟斤拷锟斤拷锟斤拷锟铰匡拷锟杰伙拷锟斤拷锟斤拷锟解。
锟缴癸拷时锟斤拷锟斤拷 TRUE
锟斤拷 锟斤拷锟斤拷锟斤拷失锟斤拷时锟斤拷锟斤拷 FALSE
锟斤拷
Example #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.');
}
?>