以下代码使用FWRITE功能。但是我希望将文件保存到特定位置,但总是按预期得到“无法打开文件”。我已经设置了mypath中列出的目录,但它仍然不会写入该位置。FWRITE()将文件保存到特定位置
$mypath = "http://www.mysite.com/test/data/";
$myFile = $mypath."data.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "Some text";
fwrite($fh, $stringData);
fclose($fh);