位置: 编程技术 - 正文

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

  • 个体户免税金额现在是多少
  • 公司申请破产后股东需要还债吗
  • 无形资产价值评估收费
  • 通用机打发票还能用吗
  • 附加税减免吗
  • 二房东转租需要备案吗
  • 火车票丢失可以抵扣进项税额
  • 旅行社支付导游费怎么算
  • 科技人员股权奖励
  • 合作建房分配比例 如何确定
  • 一般纳税人出售固定资产税率
  • 集团内关联企业有哪些
  • 软件企业怎么享受三免两减半
  • 未成立工会的企业、事业单位
  • 企业所得税如何计算
  • 淘宝店铺毛利率多少是正常
  • 金蝶标准版年末已经结账如果重新结账
  • 出售股权收入会计分录
  • 忘记用户登录密码怎么办
  • windows4月更新
  • 其他应付款在现金流量表怎么填
  • 在建工程账务处理包括哪些内容
  • 债券到期收回本息计算单
  • 营改增后企业一般纳税人认定标准为
  • 融资租赁怎么做到表外
  • android_app.intro
  • 网络工程师笔记大全
  • 企业取得交易性金融资产时
  • python的复制命令
  • javascripts
  • tomcat服务器在哪个位置
  • 贷款和应收款项属于金融资产吗
  • 企业账户有什么好处
  • 开发支出的含义
  • 反写必须15号之前吗
  • 商品过期的会计分录
  • 营改增之后还有营业税金及附加吗
  • 应付工资怎么记账
  • python计算集合交集并集个数
  • 上一年度的费用能入今年账吗
  • 核定扣除投入产品怎么算
  • 应收账款可以挂存货吗
  • 没有发票的费用支出怎么入账
  • 不符合资本化的长期借款利息计入什么科目
  • 确认借款无法收款怎么办
  • 残保金申报常见问题
  • 会员卡充值赠送金额怎么做账
  • 应收账款和预收账款都是企业的流动资产
  • 房屋租赁产生的税费叫什么
  • 公司卖废品收入要交增值税
  • 购置固定资产进项税处理的变迁
  • 建筑业发票的相关要求
  • 旅游费用如何记账科目
  • 经济往来怎么写
  • sql 修改表的字段名称
  • solaris教程
  • Windows Server 2016第三技术预览版新特性详解:容器是亮点
  • windows server 2003与2008的区别联系与选择指南
  • 苹果mac 最新系统
  • 微软每月补丁更新一般于什么时间发布
  • u大师教程
  • egui.exe是什么进程
  • linux,windows
  • kvm支持的系统
  • centos 操作
  • windows8功能设置
  • 电脑显示无windows
  • win8计算器在哪里找
  • win7系统添加右键菜单在哪里设置
  • windows图片锁屏
  • windows8.1怎么设置密码
  • 围绕摄像机旋转怎么设置
  • 日历插件vue
  • 如何删掉win7系统
  • Android HandlerThread 实例
  • inline-block
  • js uridecode
  • 为什么虚开增值税属于犯罪行为
  • 甘肃省35条措施的内容是什么
  • 没有代理记账资质的公司从事代理记账业务
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设