我有一个 PHP 脚本,需要检查目录的权限以确保它可写。到目前为止我所拥有的是:
$perms = substr(sprintf('%o', fileperms($folder)), -4);
if ($perms == "0777" || is_writable('temp'.DS))
{
//code here
}
这是足够的检查吗?
不需要手动检查权限,使用use就可以了is_writable http://php.net/manual/en/function.is-writable.php and is_dir http://php.net/manual/en/function.is-dir.php:
if (is_dir($myDir) && is_writable($myDir)){
//do stuff
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)