让我更详细地解释一下。我正在尝试编写一个程序,该程序从远程 FTP 服务器下载文件,在文件末尾附加一行,然后重新上传。文件操作有效,文本被附加到文件并重新上传,但是当我再次下载文件时,没有附加文本。我写了一个小测试程序来证明这一点;这是 Pastebin 的代码:
该程序在初始运行和后续运行中都打印以下输出:
Remote URL: ftp://orangesquirrels.com
Got data.
Local data file size: 678 bytes.
Current position in file: 678
Uploading database file back to server...
Local data file size: 690 bytes.
Remote URL is ftp://orangesquirrels.com !
*** We read 690 bytes from file.
如果程序有效,则后续运行的输出应为:
Remote URL: ftp://orangesquirrels.com
Got data.
Local data file size: 690 bytes.
Current position in file: 690
Uploading database file back to server...
Local data file size: 702 bytes.
Remote URL is ftp://orangesquirrels.com !
*** We read 702 bytes from file.
因为数据被写入文件并重新上传(我知道这是因为上传的文件比下载的文件大)我假设上传有效;我怀疑问题出在下载过程和/或curl_database_write
功能上。我一直在尽人道地尽一切可能找出发生这种情况的原因,但无济于事。如果有人知道为什么这不起作用,我很想知道。我得到报酬来编写这个程序,我知道我必须尽快找到解决方案......