1. Trang chủ
  2. » Công Nghệ Thông Tin

PHP Developer''''s Dictionary- P40 ppt

5 225 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 5
Dung lượng 363,24 KB

Nội dung

PHP Developer’s Dictionary IT-SC book 195 int ftp_delete(int ftp_stream, string file) Description The ftp_delete() function deletes file , which can include the absolute path as well, on the machine connected to through ftp_stream. If the deletion is successful, 1 is returned; otherwise, 0 is returned on an error. ftp_fget() Syntax int ftp_fget(int ftp_stream, int file_pointer, string remote_file, int mode) Description The ftp_fget() function retrieves remote_file and writes it to file_pointer from ftp_stream . If FTP_ASCII is passed as mode , the file is transferred in ASCII, or "text" mode. If FTP_BINARY is passed, the file is transferred in binary, or "source" mode. This function returns 1 if successful, and 0 if an error occurs. ftp_fput() Syntax int ftp_fput(int ftp_stream, string remote_file, int file_pointer, int mode) Description The ftp_fput() function puts the data defined by file_pointer and stores it as remote_file on the machine connected to by ftp_stream . If FTP_ASCII is passed as mode , the file is transferred in ASCII, or "text" mode. If FTP_BINARY is passed, the file is transferred in binary, or "source" mode. This function returns 1 if successful, and 0 if an error occurs. ftp_get() Syntax PHP Developer’s Dictionary IT-SC book 196 int ftp_get(int ftp_stream, string local_file, string remote_file, int mode) Description The ftp_get() function retrieves remote_file and stores it as local_file from ftp_stream. If FTP_ASCII is passed as mode, the file is transferred in ASCII, or "text" mode. If FTP_BINARY is passed, the file is transferred in binary, or "source" mode. This function returns 1 if successful, and 0 if an error occurs. Here is a quick example that puts local.txt on the remote system, whose connection is defined by $my_conn. On the remote system, the file—which is transferred in ASCII mode—is named remote.txt . $status = ftp_get($my_conn, 'local.txt', 'remote.txt', FTP_ASCII); ftp_login() Syntax int ftp_login(int ftp_stream, string username, string password) Description The ftp_login() function takes the passed ftp_stream , which is the name handle of a previously opened stream using ftp_connect() , and passes it username and password to login. If the function is successful, 1 is returned; otherwise, 0 is returned when an error has occurred. ftp_mdtm() Syntax int ftp_mdtm(int ftp_stream, string remote_file) Description The ftp_mdtm() function returns the last modified timestamp of remote_file connected to through ftp_stream . A UNIX timestamp is returned if successful; otherwise, a –1 is returned on error. Note PHP Developer’s Dictionary IT-SC book 197 Not all FTP servers support this feature. ftp_mkdir() Syntax string ftp_mkdir(int ftp_stream, string directory) Description The ftp_mkdir() function creates directory in the current working directory of ftp_stream , which is the name handle of a previously opened stream using ftp_connect() . If successful, the name of the new directory created is returned. If the function is unsuccessful, 0 is returned. ftp_nlist() Syntax int ftp_nlist(int ftp_stream, string directory) Description The ftp_nlist() function, like ftp_rawlist() , returns the list of files, in an array, in directory through ftp_stream , which is the name handle of a previously opened stream using ftp_connect() . If the operation was unsuccessful, 0 is returned. ftp_pasv() Syntax int ftp_pasv(int ftp_stream, int boolean) Description The ftp_pasv() function turns on passive mode (data connection initiated by client rather than server) on the machine connected to by ftp_stream if boolean is 1 , and turns it off if boolean is 0 . If an error occurs, 0 is returned by the function. PHP Developer’s Dictionary IT-SC book 198 ftp_put() Syntax int ftp_put(int ftp_stream , string remote_file , string local_file , int mode) Description The ftp_put() function puts local_file and stores it as remote_file on the machine connected to by ftp_stream . If FTP_ASCII is passed as mode, the file is transferred in ASCII, or "text" mode. If FTP_BINARY is passed, the file is transferred in binary, or "source" mode. This function returns 1 if successful, and 0 if an error occurs. ftp_pwd() Syntax int ftp_pwd(int ftp_stream) Description The ftp_pwd() function returns the path of the working directory, on the remote machine, for ftp_stream , which is the name handle of a previously opened stream using ftp_connect() . If the function call fails, 0 is returned. The following example shows how you can print the current directory of an open FTP connection, defined by $my_conn . echo ftp_pwd($my_conn); ftp_quit() Syntax int ftp_quit(int ftp_stream) Description PHP Developer’s Dictionary IT-SC book 199 The ftp_quit() function closes the ftp_stream connection that was opened by ftp_connect() . ftp_rawlist() Syntax int ftp_rawlist(int ftp_stream, string directory) Description The ftp_rawlist() function, as with ftp_list() , returns the list of files, in an array, in directory through ftp_stream, which is the name handle of a previously opened stream using ftp_connect() . The difference is that ftp_rawlist() executes a LIST FTP command for the array and each line returned represents one line of text from the command execution. If the operation was unsuccessful, 0 is returned. Note If you want to know what kind of information is returned in the list, you can use the ftp_systype() function to return the system type identifier. ftp_rename() Syntax int ftp_rename(int ftp_stream, string old_name, string new_name) Description The ftp_rename() function renames the old_name file to new_name on the machine connected to through ftp_stream . If the renaming was successful, 1 is returned; otherwise, 0 is returned on an error. ftp_rmdir() Syntax int ftp_rmdir(int ftp_stream, string directory) . PHP Developer’s Dictionary IT-SC book 195 int ftp_delete(int ftp_stream, string file) Description. mode. This function returns 1 if successful, and 0 if an error occurs. ftp_get() Syntax PHP Developer’s Dictionary IT-SC book 196 int ftp_get(int ftp_stream, string local_file, string. ftp_stream . A UNIX timestamp is returned if successful; otherwise, a –1 is returned on error. Note PHP Developer’s Dictionary IT-SC book 197 Not all FTP servers support this feature. ftp_mkdir()

Ngày đăng: 07/07/2014, 05:20