PHP无法打开远程文件 [英] PHP can't fopen remote file
本文介绍了PHP无法打开远程文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在制作一个脚本来打开远程文件(ftp)并用fopen和fwrite编辑它.我在连接ftp时遇到问题.我编写了这段代码
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变量.我在网页中尝试使用ftp://...并起作用.allow_url_fopen处于打开状态... 它只是说"ftp错误"
al variables are set.I tried with ftp://... in web page and it works.allow_url_fopen is On... It just says "ftp error"
推荐答案
ftp://
处理程序创建文件.
The ftp://
handler only allows creating new files with fopen("ftp://...", "w");
.
如果文件已经存在,则只有在以覆盖集(即模式w+
)打开文件时,才能对其进行写操作.
If the file already exists you can only write to it if you open it with overwriting set, i.e mode w+
.
这篇关于PHP无法打开远程文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文