(PHP 4, PHP 5, PHP 7)
ftp_size — 锟斤拷锟斤拷指锟斤拷锟侥硷拷锟侥达拷小
$ftp_stream
, string $remote_file
) : int
ftp_size() 锟斤拷锟斤拷锟斤拷锟街节凤拷锟斤拷远锟斤拷锟侥硷拷
remote_file
锟侥达拷小锟斤拷锟斤拷锟街革拷锟斤拷募锟斤拷锟斤拷锟斤拷诨锟斤拷锟斤拷锟斤拷锟斤拷蚍祷锟�
-1锟斤拷锟斤拷些 FTP 锟斤拷锟斤拷锟斤拷锟斤拷锟杰诧拷支锟街达拷锟斤拷锟皆★拷
Note:
锟斤拷取锟缴癸拷锟斤拷锟斤拷锟侥硷拷锟斤拷小锟斤拷锟斤拷锟津返伙拷 -1锟斤拷
ftp_stream
FTP 锟斤拷锟斤拷锟斤拷源锟斤拷
remote_file
远锟斤拷锟侥硷拷锟斤拷
执锟叫成癸拷锟斤拷锟斤拷锟侥硷拷锟斤拷小锟斤拷失锟杰凤拷锟斤拷 -1锟斤拷
Example #1 ftp_size() 锟斤拷锟斤拷
<?php
$file = 'somefile.txt';
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// get the size of $file
$res = ftp_size($conn_id, $file);
if ($res != -1) {
echo "size of $file is $res bytes";
} else {
echo "couldn't get the size";
}
//close the conntion
ftp_close($conn_id);
?>