首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

ftp_site

(PHP 4, PHP 5, PHP 7)

ftp_site - 将SITE命令发送到服务器

描述

代码语言:javascript
复制
bool ftp_site ( resource $ftp_stream , string $command )

ftp_site()将给定的SITE命令发送到FTP服务器。

SITE命令不是标准化的,因服务器而异。它们对于处理诸如文件权限和组成员资格等有用。

参数

ftp_stream

FTP连接的链接标识符。

command

SITE命令。请注意,此参数不会转义,因此可能会出现包含空格和其他字符的文件名问题。

返回值

成功时返回TRUE或失败时返回FALSE

例子

示例#1将SITE命令发送到FTP服务器

代码语言:javascript
复制
<?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.');
}
?>

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com