Setting folder permissions in Windows via PHP

笑着哭i 提交于 2019-12-20 05:42:27

问题


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\

I can't seem to find any PHP functions for Windows filesystems for PHP

Any ideas?


回答1:


Despite using the Unix file permission syntax, PHP's chmod() function does work in Windows (I just tested it).

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).

Hope that helps.




回答2:


If you have the ability to call command-line processes, you could use SetACL (if you need very detailed control) otherwise, CACLS is built in.



来源:https://stackoverflow.com/questions/6732934/setting-folder-permissions-in-windows-via-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!