人工渣翻译来了。
要使用ftp首先要装入ftp库对不对?
-- loads the FTP module and any libraries it requires
local ftp = require("socket.ftp")
ftp服务器都有一个地址,端口号,用户名,密码,等等。
假设现在的
服务器地址为192.168.125.101
端口默认80
用户名:czfshine
密码:我才不会告诉你
要下载的文件路径在根目录下的lua目录里的czf.lua文件 :/lua/czf.lua
传输模式不管它默认为i 也可以是a。
把上面的数据按照下面的格式链接成字符串:
[ftp://][<user>[:<password>]@]<host>[:<port>][/<path>][type=a|i]
ftp://czfshine:我才不会告诉你@192.168.125.101:80/lua/czf.lua;type=i
-------------------------------------------------------
ftp.get函数用上面那个字符串做参数,返回一个文件句柄和错误信息
-----------------------------------------------------
file,error=ftp.get(“
ftp://czfshine:我才不会告诉你@192.168.125.101:80/lua/czf.lua;type=i”)
if not file then
print("ftp 出错啦!“)
print(error)
os.exit()
end
outfile,error=io.open("czf.lua","w")
if not outfile then
print("打开输出文件时出错啦!“)
print(error)
os.exit()
end
outfile(file:read("*a")
file:close()
outfile:close()
---------------------------------------------------------------------------------