我正在导出一些数据,制作文件并将数据写入文件......
我的文件出现在 ftp 服务器上,但它是空的...
这是代码。
//Connect to the FTP server
$ftpstream = @ftp_connect('localhost');
//Login to the FTP server
$login = @ftp_login($ftpstream, 'some_login', 'some_password');
if($login) {
//We are now connected to FTP server.
//Create a temporary file
$temp = tmpfile();
//Upload the temporary file to server
@ftp_fput($ftpstream, '/httpdocs/itineraryschedule.txt', $temp, FTP_ASCII);
//Make the file writable by all
ftp_site($ftpstream,"CHMOD 0777 /httpdocs/itineraryschedule.txt");
//Write to file
$fp = fopen('var/www/vhosts/cruiseandmaritime.com/httpdocs/itineraryschedule.txt', 'w');
fputs($fp, 'some data');
fclose($fp);
//Make the file writable only to owner
ftp_site($ftpstream,"CHMOD 0644 /httpdocs/itineraryschedule.txt");
}
我很困惑!
富有的 :)