【发布时间】:2013-05-17 01:48:27
【问题描述】:
我有这个代码
$ext = ".txt";
$filename = $namef.$ext;
if(!file_exists($filename))
{
$file = fopen($filename,"w");
fwrite($file, $privatekey);
fclose($file);
chmod($file,0777);
}
$namef 是输入到此程序中的任何名称。
但是,当我运行它时,我不断得到:
Unable to access (name_of_file).txt in something.php
Warning: fopen(name_of_file.txt) [function.fopen]: failed to open stream: No such file or directory in something.php
Warning: fwrite(): supplied argument is not a valid stream resource in ./something.php on line 79
Warning: fclose(): supplied argument is not a valid stream resource in ./something.php on line 80
Warning: chmod() [function.chmod]: Unable to access in ./something.php on line 81
我可以知道是否可以创建动态文本文件名吗?
谢谢
【问题讨论】:
-
你在写文件夹里把cdmod设置为777了吗?
-
请检查路径或至少提供您的代码和结构的真实数据以帮助其他人帮助您