PHP touch()ฟังก์ชั่น
❮ การอ้างอิงระบบไฟล์ PHPตัวอย่าง
ตั้งค่าการเข้าถึงและเวลาในการแก้ไขของไฟล์ที่ระบุ:
<?php
filename = "test.txt";
if (touch($filename)) {
echo
$filename . " modification time has been changed to present time";
} else {
echo "Sorry, could not change modification time of " . $filename;
}
?>
ความหมายและการใช้งาน
ฟังก์ชัน touch() ตั้งค่าการเข้าถึงและเวลาในการแก้ไขของไฟล์ที่ระบุ
หมายเหตุ:หากไม่มีไฟล์ที่ระบุ ไฟล์นั้นจะถูกสร้างขึ้น
ไวยากรณ์
touch(filename, time, atime)
ค่าพารามิเตอร์
Parameter | Description |
---|---|
filename | Required. Specifies the file to touch |
time | Optional. Sets the touch time. The current system time is set by default |
atime | Optional. Sets the access time. Default is the current system time if no parameters are set, or the same as the time parameter if that parameter is set |
รายละเอียดทางเทคนิค
คืนมูลค่า: | จริงกับความสำเร็จ เท็จเมื่อล้มเหลว |
---|---|
รุ่น PHP: | 4.0+ |
บันทึกการเปลี่ยนแปลง PHP: | PHP 5.3 - |
❮ การอ้างอิงระบบไฟล์ PHP