你是怎么做的? 最近,我在FTP服务器的帮助下尝试使用PHP覆盖新行到远程文件时遇到了一个问题。
我有这个功能:
function addmgusertoConfig($cfgdata)
{
$dateadd = date('Y-m-d', strtotime("+0 days"));
$handle = fopen($cfgdata,'a');
fwrite($handle, 'MG: '.$_POST["user11"].' '.$_POST["pass11"].' #
'.$_POST["skype"].' '.$_POST["host"].' '.$dateadd." # \n");
fclose($handle);
}
,同时:
$cfgdata="ftp://USER:PASSWORD@REMOTEHOST/SOMEDIR/THEFILE.txt";
当我通过php发布我的数据时,我收到此错误日志:
[05-May-2018 07:33:24 UTC] PHP Warning:
file_get_contents(ftp://...@remotehost/somedir/thefile.txt): failed to open
stream: operation failed in /home/LOCALUSER/public_html/post_page.php on
line 204
[05-May-2018 07:33:24 UTC] PHP Warning:
fopen(ftp://...@remotehost/somedir/thefile.txt): failed to open stream:
operation failed in /home/LOCALUSER/public_html/functions.php on line 202
[05-May-2018 07:33:24 UTC] PHP Warning: fwrite() expects parameter 1 to be
resource, boolean given in /home/LOCALUSER/public_html/functions.php on
line 203
[05-May-2018 07:33:24 UTC] PHP Warning: fclose() expects parameter 1 to be
resource, boolean given in /home/LOCALUSER/public_html/functions.php on line
204
[05-May-2018 07:33:30 UTC] PHP Warning:
fopen(ftp://...@remotehost/somedir/thefile.txt): failed to open stream:
operation failed in /home/LOCALUSER/public_html/functions.php on line 192
[05-May-2018 07:33:30 UTC] PHP Warning: fwrite() expects parameter 1 to be
resource, boolean given in /home/LOCALUSER/public_html/functions.php on line
193
[05-May-2018 07:33:30 UTC] PHP Warning: fclose() expects parameter 1 to be
resource, boolean given in /home/LOCALUSER/public_html/functions.php on line
194
任何想法如何使用给定的函数或任何更好的函数来解决这个问题?
提前致谢..