Hàm chmod() của PHP
❮ Tham khảo hệ thống tập tin PHPVí dụ
Thay đổi quyền đối với tệp "test.txt":
<?php
// Read and write for owner, nothing for everybody else
chmod("test.txt",0600);
// Read and write for owner, read for everybody else
chmod("test.txt",0644);
// Everything for owner, read and execute for everybody else
chmod("test.txt",0755);
// Everything for owner, read for owner's group
chmod("test.txt",0740);
?>
Định nghĩa và cách sử dụng
Hàm chmod() thay đổi quyền của tệp được chỉ định.
Cú pháp
chmod( file , mode )
Giá trị tham số
Parameter | Description |
---|---|
file | Required. Specifies the path to the file |
mode | Required. Specifies the new permissions. The mode parameter consists of four numbers:
Possible values (to set multiple permissions, add up the following numbers):
|
Chi tiết kỹ thuật
Giá trị trả về: | ĐÚNG nếu thành công, SAI nếu thất bại |
---|---|
Phiên bản PHP: | 4.0+ |
❮ Tham khảo hệ thống tập tin PHP