11
This commit is contained in:
@@ -22,12 +22,10 @@ class AccessControl implements MiddlewareInterface
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查当前是否已有写入权限
|
// 检查当前是否已有写入权限
|
||||||
if (is_writable($filePath)) {
|
if (is_writable($filePath)) {
|
||||||
return true; // 已有写入权限,无需修改
|
return true; // 已有写入权限,无需修改
|
||||||
}
|
}
|
||||||
|
|
||||||
// 尝试设置权限
|
// 尝试设置权限
|
||||||
if (chmod($filePath, $permission)) {
|
if (chmod($filePath, $permission)) {
|
||||||
return true;
|
return true;
|
||||||
@@ -45,11 +43,8 @@ class AccessControl implements MiddlewareInterface
|
|||||||
mkdir($logDir, 0755, true); // 创建目录,权限755
|
mkdir($logDir, 0755, true); // 创建目录,权限755
|
||||||
}
|
}
|
||||||
// 给文件设置写入权限(使用0664权限,比0666更安全)
|
// 给文件设置写入权限(使用0664权限,比0666更安全)
|
||||||
if (setFileWritePermission($logFile)) {
|
setFileWritePermission($logFile);
|
||||||
echo "文件已拥有写入权限: $logFile";
|
|
||||||
} else {
|
|
||||||
echo "无法设置文件写入权限,请检查服务器配置: $logFile";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user