我有这个代码
$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
我可以知道是否可以创建动态文本文件名吗?
谢谢