ftp_put() 函數將檔案上傳到 FTP 伺服器。
ftp_put(con,remote_file,local_file,mode,beg_pos);
#con - FTP連線
<?php $ftp_server = "192.168.0.4"; $ftp_user = "tim"; $ftp_pass = "wthbn#@121"; $con = ftp_connect($ftp_server) or die("Could not connect to $ftp_server"); $login = ftp_login($con, $ftp_user, $ftp_pass); $local_file = "localfile.txt"; $my_serverfile = "serverfile.txt"; if (ftp_put($ftp_conn, $my_serverfile, $local_file, FTP_ASCII)){ echo "File uploaded!"; } else { echo "Error in uploading the file!"; } // close ftp_close($con); ?>###
以上是在PHP中的ftp_put()函數的詳細內容。更多資訊請關注PHP中文網其他相關文章!