PHP chmod()ฟังก์ชั่น
❮ การอ้างอิงระบบไฟล์ PHPตัวอย่าง
เปลี่ยนการอนุญาตสำหรับไฟล์ "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);
?>
ความหมายและการใช้งาน
ฟังก์ชัน chmod() เปลี่ยนการอนุญาตของไฟล์ที่ระบุ
ไวยากรณ์
chmod(file, mode)
ค่าพารามิเตอร์
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):
|
รายละเอียดทางเทคนิค
คืนมูลค่า: | จริงกับความสำเร็จ เท็จเมื่อล้มเหลว |
---|---|
รุ่น PHP: | 4.0+ |
❮ การอ้างอิงระบบไฟล์ PHP