File文件 中的 chmod()函数

首页 / PHP入门教程 / File文件 中的 chmod()函数

chmod() - 语法

bool chmod ( string $filename, int $mode );

尝试将指定文件的模式更改为模式中给定的模式。

filename      -  文件路径。

mode           -  请注意,不会自动将mode假定为八进制值,因此字符串(例如“ g + w”)将无法正常工作。 为了确保预期的操作,您需要在模式前加上零(0)

无涯教程网

chmod() - 返回值

成功时返回TRUE,失败时返回FALSE。

chmod() - 示例

<?php
   //Read and write for owner, nothing for everybody else
   chmod("hello.txt", 0600);
   
   //Read and write for owner, read for everybody else
   chmod("hello.txt", 0644);
   
   //Everything for owner, read and execute for others
   chmod("hello.txt", 0755);
   
   //Everything for owner, read and execute for owner's group
   chmod("hello.txt", 0750);
?>

祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

技术教程推荐

快速上手Kotlin开发 -〔张涛〕

TensorFlow快速入门与实战 -〔彭靖田〕

编译原理实战课 -〔宫文学〕

Vim 实用技巧必知必会 -〔吴咏炜〕

To B市场品牌实战课 -〔曹林〕

Flink核心技术与实战 -〔张利兵〕

用户体验设计实战课 -〔相辉〕

结构会议力 -〔李忠秋〕

互联网人的数字化企业生存指南 -〔沈欣〕

好记忆不如烂笔头。留下您的足迹吧 :)