search
Homephp教程php手册php ftp_delete 与ftp_size教程

php ftp_delete 与ftp_size教程

Jun 13, 2016 am 10:09 AM
deleteftpphpssizeone timeanddeleteTutorialdocumentarticle

本文章来讲一下php ftp_delete删除文件 与ftp_size获取文件的大小,下面我们分别来看看二个函数的实例吧。

本文章来讲一下php ftp_delete删除文件 与ftp_size获取文件的大小,下面我们分别来看看二个函数的实例吧。

$file = 'public_html/old.txt';
// 连接FTP服务器
$conn_id = ftp_connect($ftp_server);
// 验证用户名和密码
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// 删除指定文件
if (ftp_delete($conn_id, $file)) {
echo "$file 文件删除成功 n";
} else {
echo "删除 $file 文件失败n";
}
// 关闭FTP连接www.111cn.cn
ftp_close($conn_id);
?>

$file = 'somefile.txt';
// 连接FTP服务器
$conn_id = ftp_connect($ftp_server);
//验证用户名和密码
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
//获取指定文件的大小www.111cn.cn
$res = ftp_size($conn_id, $file);
if ($res != -1) {
    echo " $file 文件大小为 $res字节";
} else {
    echo "获取远程文件大小失败";
}
//关闭FTP连接
ftp_close($conn_id);
?> 

转载的朋友请注明来自www.111cn.cn

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools