[英]Setting folder permissions in Windows via PHP
Is there a way to properly set folder permissions via PHP on a Windows filesystem, such as granting user A
full access, and user B
read-only on folder \\fileserver\shares\users\A\
有没有办法通过 PHP 在 Windows 文件系统上正确设置文件夹权限,例如授予user A
完全访问权限,以及授予用户user B
对文件夹\\fileserver\shares\users\A\
的只读权限
I can't seem to find any PHP functions for Windows filesystems for PHP我似乎找不到 PHP 的 Windows 文件系统的任何 PHP 函数
Any ideas?有任何想法吗?
Despite using the Unix file permission syntax, PHP's chmod()
function does work in Windows (I just tested it).尽管使用 Unix 文件权限语法,PHP 的chmod()
function 确实在 Windows 中工作(我刚刚测试过)。
If your user A was the file owner and user B wasn't then it would be easy to grant one set of permissions to user A and different permissions to user B. You can set the owner of a file using the chown()
function (again, Unix-like syntax, but works with Windows, subject to your PHP program having sufficient permissions to itself to make the change).如果您的用户 A 是文件所有者而用户 B 不是,那么很容易向用户 A 授予一组权限,向用户 B 授予不同的权限。您可以使用chown()
function (同样,类 Unix 语法,但适用于 Windows,前提是您的 PHP 程序对自身具有足够的权限来进行更改)。
Hope that helps.希望有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.