问题
I'm making a script to open remote file (ftp) and edit it with fopen and fwrite.I have problem while connecting to ftp.I made this code
$handle = fopen("ftp://".$ftp['username'].":".$ftp['password']."@".$ftp['server']."/cstrike/addons/amxmodx/configs/users.ini", "w") or die("ftp error");
fwrite($handle,$text."\n") or die('err2.');
al variables are set.I tried with ftp://... in web page and it works.allow_url_fopen is On... It just says "ftp error"
回答1:
The ftp://
handler only allows creating new files with fopen("ftp://...", "w");
.
If the file already exists you can only write to it if you open it with overwriting set, i.e mode w+
.
来源:https://stackoverflow.com/questions/10552388/php-cant-fopen-remote-file