<?php $temporary_directory = "C:\Apache Group\Apache2\htdocs\mail\temporary_files"; if(file_exists($temporary_directory)) { echo "The file exists"; } else { echo "The file does not exist"; } if(!is_writable($temporary_directory)) die("<h3>The folder \"$temporary_directory\" do not exists or the webserver don't have permissions to write</h3>"); echo "over"; ?>结果是: The file exists The folder \"$temporary_directory\" do not exists or the webserver don't have permissions to write 为什么is_writable判断是不存在?
现在问题找到了,就是is_writeable不能判断存在的文件夹,又写个测试, <?php $filename = 'temporary_files/';if (is_writable($filename)) { echo 'The file is writable'; } else { echo 'The file is not writable'; }if(file_exists($filename)) { echo "The file exists"; } else { echo "The file does not exist"; } ?〉 结果是 The file is not writable The file exists ,那怎么设置才能让文件夹writeable?
upload_tmp_dir=指向的目录是在那里?最好是在你PHP安装文同个文件夹下。
$temporary_directory = "C:\Apache Group\Apache2\htdocs\mail\temporary_files";
if(file_exists($temporary_directory))
{
echo "The file exists";
}
else
{
echo "The file does not exist";
} if(!is_writable($temporary_directory)) die("<h3>The folder \"$temporary_directory\" do not exists or the webserver don't have permissions to write</h3>");
echo "over";
?>结果是:
The file exists
The folder \"$temporary_directory\" do not exists or the webserver don't have permissions to write
为什么is_writable判断是不存在?
(PHP 4, PHP 5)is_writable -- 判断给定的文件名是否可写
<?php
$filename = 'temporary_files/';if (is_writable($filename)) {
echo 'The file is writable';
} else {
echo 'The file is not writable';
}if(file_exists($filename))
{
echo "The file exists";
}
else
{
echo "The file does not exist";
}
?〉
结果是
The file is not writable
The file exists
,那怎么设置才能让文件夹writeable?
函数修改文件夹权限