有没有一种方法可以切换“隐藏"页面?或“只读"使用PHP打开Windows文件? [英] Is there a way to toggle the "Hidden" or "Read-Only" switches on a Windows file using PHP?

查看:114
本文介绍了有没有一种方法可以切换“隐藏"页面?或“只读"使用PHP打开Windows文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

已更新

正如标题所述,是否可以使用PHP在Windows上切换隐藏"或只读"开关?

As the title says, is there a way to toggle the "Hidden" or "Read-Only" switch on Windows using PHP?

如果可能的话,我希望不打开外壳exec().

I'd like to do this without opening a shell exec() if possible.

推荐答案

不能隐藏文件,该文件始终位于文件系统中. * NIX约定,对于某些操作(例如ls命令),默认情况下不会显示以.开头的文件,但前提是您看起来不足够. Windows也是如此,但是Windows使用文件元属性来处理它.

A file can't be hidden, it's always in the file system. There's the *NIX convention that files starting with a . are not shown by default for certain operations (like the ls command), but only if you don't look hard enough. The same goes for Windows, but Windows handles it with file meta attributes.

您可以/应该做的是使用文件权限,使没有业务访问权限的任何人都无法访问该文件夹/文件.使用 chmod chgrp 从PHP执行.不过,您可能需要了解一些有关适当的文件系统权限的信息.

What you can/should do is use file permissions to make the folder/file inaccessible to anybody who has no business accessing it. Use chmod, chown and chgrp to do so from PHP. You may have to learn a bit about proper file system permissions though.

这篇关于有没有一种方法可以切换“隐藏"页面?或“只读"使用PHP打开Windows文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆