尝试在Linux上使用php5编写文件 [英] Try to write files using php5 on Linux
问题描述
帮助!
我在Linux上使用SuSE 9.3,php5和Apache2。我尝试使用以下命令将文件写入
硬盘:
$ filename =" test.txt" ;;
if(!file_exists($ filename))
touch($ filename);
if(is_writable($ filename))
$ myfile = fopen($ filename,''w +'');
else
{
echo"无法写入文件($ filename )" ;;
退出(1);
}
脚本既不会创建文件也不会将其打开以进行写入。当在Windows上使用
相同的脚本时,一切正常,所以我认为这是一个
权限问题。
提前谢谢,$ / b
Help!
I am using SuSE 9.3, php5 and Apache2 on Linux. I try to write files to
the hard drive using the following command:
$filename = "test.txt";
if (!file_exists($filename))
touch($filename);
if (is_writable($filename))
$myfile = fopen( $filename,''w+'');
else
{
echo "Cannot write to file ($filename)";
exit(1);
}
The script neither creates a file nor open it for writing. When using
the same script on Windows everything works fine so I think it is a
permission problem.
Thanks in advance,
Matthias
推荐答案
filename =" test.txt";
if(!file_exists(
filename = "test.txt";
if (!file_exists(
filename))
touch(
filename))
touch(
filename);
if(is_writable(
filename);
if (is_writable(
这篇关于尝试在Linux上使用php5编写文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!