位置: 编程技术 - 正文

PHP:fileperms()的用法_Filesystem函数(php_fileinfo作用)

编辑:rootadmin
fileperms

推荐整理分享PHP:fileperms()的用法_Filesystem函数(php_fileinfo作用),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:php file_append,php_fileinfo作用,php_fileinfo,php的file_get_contents,php_fileinfo作用,php_fileinfo作用,php中file,php中file,内容如对您有帮助,希望把文章链接给更多的朋友!

(PHP 4, PHP 5)

fileperms — 取得文件的权限

说明 int fileperms ( string $filename )

取得文件的权限。

参数

filename

文件的路径。

返回值

以数字模式返回文件的访问权限。 Returns the file&#;s permissions as a numeric mode. Lower bits of this mode are the same as the permissions expected by chmod(), however on most platforms the return value will also include information on the type of file given as filename. The examples below demonstrate how to test the return value for specific permissions and file types on POSIX systems, including Linux and Mac OS X.

For local files, the specific return value is that of the st_mode member of the structure returned by the C library&#;s stat() function. Exactly which bits are set can vary from platform to platform, and looking up your specific platform&#;s documentation is recommended if parsing the non-permission bits of the return value is required.

范例 PHP:fileperms()的用法_Filesystem函数(php_fileinfo作用)

Example #1 以八进制的形式显示文件的权限

<?phpechosubstr(sprintf('%o',fileperms('/tmp')),-4);echosubstr(sprintf('%o',fileperms('/etc/passwd')),-4);?>

以上例程会输出:

Example #2 输出全部权限

<?php$perms=fileperms('/etc/passwd');if(($perms&0xC)==0xC){//Socket$info='s';}elseif(($perms&0xA)==0xA){//SymbolicLink$info='l';}elseif(($perms&0x)==0x){//Regular$info='-';}elseif(($perms&0x)==0x){//Blockspecial$info='b';}elseif(($perms&0x)==0x){//Directory$info='d';}elseif(($perms&0x)==0x){//Characterspecial$info='c';}elseif(($perms&0x)==0x){//FIFOpipe$info='p';}else{//Unknown$info='u';}//Owner$info.=(($perms&0x)?'r':'-');$info.=(($perms&0x)?'w':'-');$info.=(($perms&0x)?(($perms&0x)?'s':'x'):(($perms&0x)?'S':'-'));//Group$info.=(($perms&0x)?'r':'-');$info.=(($perms&0x)?'w':'-');$info.=(($perms&0x)?(($perms&0x)?'s':'x'):(($perms&0x)?'S':'-'));//World$info.=(($perms&0x)?'r':'-');$info.=(($perms&0x)?'w':'-');$info.=(($perms&0x)?(($perms&0x)?'t':'x'):(($perms&0x)?'T':'-'));echo$info;?>

以上例程会输出:

错误/异常

失败时抛出E_WARNING警告。

注释

Note: 此函数的结果会被缓存。参见clearstatcache() 以获得更多细节。

Tip

自 PHP 5.0.0 起, 此函数也用于某些URL 包装器。请参见 支持的协议和封装协议以获得支持 stat() 系列函数功能的包装器列表。

参见

chmod() - 改变文件模式 is_readable() - 判断给定文件名是否可读 stat() - 给出文件的信息

PHP:filemtime()的用法_Filesystem函数 filemtime(PHP4,PHP5)filemtime取得文件修改时间说明intfilemtime(string$filename)本函数返回文件中的数据块上次被写入的时间,也就是说,文件的内容上次被修改的

PHP:fileowner()的用法_Filesystem函数 fileowner(PHP4,PHP5)fileowner取得文件的所有者说明intfileowner(string$filename)取得文件的所有者。参数filename文件的路径。返回值返回文件所有的用户ID,如果出错

PHP:filegroup()的用法_Filesystem函数 filegroup(PHP4,PHP5)filegroup取得文件的组说明intfilegroup(string$filename)取得该文件所属组的ID。组ID以数字格式返回,用posix_getgrgid()来将其解析为组名。参数filen

标签: php_fileinfo作用

本文链接地址:https://www.jiuchutong.com/biancheng/285220.html 转载请保留说明!

上一篇:PHP:diskfreespace()的用法_Filesystem函数

下一篇:PHP:filemtime()的用法_Filesystem函数(php的file函数)

  • 企业存款利息收入缴纳企业所得税吗
  • 研究经费怎么写
  • 公司两个股东各占50%股份,法人是股东
  • 天猫收取的佣金开具的技术服务发票会计分录
  • 增值税发票的抵扣联丢了怎么办
  • 销售金银首饰消费税怎么算
  • 收到别的公司的转账支票
  • 购入材料时,会出现哪几种情况
  • 应缴纳的所得税税额
  • 原材料投资入股协议约定价值公允价值
  • 印花税加工承揽税率
  • 股东划入资产会计处理
  • 绿化费用明细
  • 应付供货单位的货款属于什么会计科目
  • 增值税普通发票红冲之后还能查询吗
  • 公司研发产品
  • 怎样处理教育费附加会计分录?
  • 电子发票怎么打成A4纸一半
  • 现金清查制度的内容包括
  • win11系统进程
  • 利润是如何转化成平均利润的
  • 文字转换表格怎么设置行列
  • php面向对象的三大特征
  • 带息应收票据的核算
  • 银行对公中收
  • 其他应付款的会计科目
  • 提足折旧仍使用的逾龄房产是否交房产税
  • 简单了解航天员的生活
  • 基金公司做销售有前途吗
  • 雷瓦老板
  • pytorch example
  • 小规模纳税人收入会计分录
  • vue里的for循环
  • 增值税附加税减免政策2022年
  • 小规模如何申报增值税
  • 罚款属于其他业务收入吗
  • 无追保理是投资还是投资
  • 员工高铁票能抵扣吗
  • 商业汇票如何申请操作
  • 内账需要哪些单据
  • 公共电话亭的话费怎么算
  • 国有企业无偿划转股权缴纳印花税
  • 零退税率可以做免税吗
  • 在建工程抵押贷款的用途为在建工程继续建造所需资金
  • 增值税申报销项数据怎么自动带出来
  • 品牌代理费计入什么科目
  • 定额发票怎么领?
  • 短期理财收益账务分录
  • 苗木种植发票免税怎么开
  • 新会计准则经营租赁
  • 总账设置包括哪些内容
  • mysql tmp_table_size和max_heap_table_size大小配置
  • Sql Server datetime问题
  • 批量sql语句
  • winxp系统纯净版
  • windows资源管理器
  • debian和ubuntu server
  • macbook怎么剪视频软件
  • linux config
  • 如何解决windows副本不是正版
  • win10系统网络连接配置异常
  • 不错的mod_perl编程的简单应用实例介绍
  • opengl和openglskia
  • angularjs2
  • linux ls-l命令详解
  • 如何消除手机自动出现的广告
  • javascript的核心语言对象包括
  • js md5加密方法
  • 获取标签的属性值的方式
  • python的queue
  • 轮廓模式
  • android 分辨率适配
  • 个体 税务登记
  • 税务数字证书密码修改失败
  • 小规模增值税减免会计科目
  • 2022年最新最全执业药师继续教育考试答案
  • 中山市国家税务总局阜沙分局局长杨兴华
  • 房产税的计税依据及税率
  • 增值税普通发票有什么用
  • 银行服务创新金点子
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

    网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

    友情链接: 武汉网站建设