位置: 编程技术 - 正文

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函数)

  • 退的个税手续费怎么做会计分录
  • 职工福利费计税税率
  • 物流公司车子
  • 社保本期工资总额是怎么填的
  • 销售商品收到的银行本票
  • 发票认证后怎么打明细
  • 申报个税是按照当月工资,做账时候发的是上月工资
  • 公积金需要每月缴纳吗
  • 用excel怎么制作思维导图
  • 债务重组损失计算公式
  • 通行费电子增值税怎么算
  • 建筑施工安全费用专项检查报告怎么写
  • 内部企业借款利息在建工程资本化
  • 银行卡收到养老金是什么意思
  • 房地产结转收入是什么意思
  • 营改增后建筑公司账务处理
  • 以下属于财政收入的形式有
  • 开给个人的普票怎么做分录
  • 实收资本的账务处理题目
  • 出租的固定资产计提折旧
  • 为什么增值税可以抵扣
  • 同一地级行政区怎么划分
  • 工资表是放在计提还是发放
  • 销售成本结转账务处理
  • 公司购买二手车怎么抵税
  • 合同的印花税税率
  • 以前固定资产入账折旧怎么提
  • 加盟费是一年一收还是终身的
  • 免税单位出租房产如何缴纳房产税
  • 或有事项确认预计负债的分录
  • 什么情况转账会延迟2天
  • 法人车无偿给公司使用合法吗
  • 苹果官网iPhone12
  • 股权转让个税怎么缴纳
  • PHP:Memcached::flush()的用法_Memcached类
  • 债务重组是什么工作
  • dsm是什么文件
  • 银行存款日记账与银行对账单之间的核对属于
  • 免抵退税额好难懂
  • vue侧边栏导航,右侧显示对应内容
  • python基本功
  • three.js入门指南
  • 车险开的发票里有代收车船税吗
  • 土地增值税扣除率怎样计算
  • 公允价值计量的投资性房地产
  • 延期缴纳税款的问题
  • python默认画布大小
  • 用vue-cli搭建项目
  • 会计为什么不能有0
  • 成品油涉及范围有哪些
  • 劳务分包的形式完成施工任务
  • 所得税费用影响企业营业利润吗
  • 广告牌制作加盟厂家
  • 先付款后收到发票
  • 购进无偿赠送
  • 在保险中,保险利益的载体是
  • 合同资产相当于以前什么会计科目
  • 开办费如何摊销成本
  • 企业发生存货盘盈时计入营业外收入科目
  • win8.1打开软件显示Error远程配置获取失败请重新启动
  • windows 10如何使用
  • directx出现错误
  • linux chmod命令用法
  • Mac苹果系统怎么转换中文
  • sxgdsenu.exe - sxgdsenu是什么进程 有什么用
  • linux cp 不是目录
  • win7系统如何将插孔设置为ac97前面板
  • 关机你的电脑遇到问题,需要重新启动,我们只收集
  • win10 rs3
  • unity接入安卓sdk
  • js创建对象的方法有哪些
  • unity简单项目
  • scp 将数据从一台linux服务器复制到另一台linux服务器
  • javascript用户名验证
  • jquery基本知识
  • android使用红杏代理更新sdk
  • 简约时尚搭配
  • 安卓接口回调例子
  • 湖南职工医保哪里交
  • 为什么企业减少注册资金的原因
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设