下面的代码使用了 FWRITE 函数。但是我希望将文件保存到特定位置,但总是按预期得到“无法打开文件”。我已经设置了 mypath 中列出的目录,但它仍然不会写入该位置。
$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);