PHP เปลี่ยนชื่อ ()ฟังก์ชั่น
❮ การอ้างอิงระบบไฟล์ PHPตัวอย่าง
เปลี่ยนชื่อไดเร็กทอรี + ไฟล์:
<?php
rename("images","pictures");
rename("/test/file1.txt","/home/docs/my_file.txt");
?>
ความหมายและการใช้งาน
ฟังก์ชัน rename() เปลี่ยนชื่อไฟล์หรือไดเร็กทอรี
ไวยากรณ์
rename(old, new, context)
ค่าพารามิเตอร์
Parameter | Description |
---|---|
old | Required. Specifies the file or directory to be renamed |
new | Required. Specifies the new name for the file or directory |
context | Optional. Specifies the context of the file handle. Context is a set of options that can modify the behavior of a stream |
รายละเอียดทางเทคนิค
คืนมูลค่า: | จริงกับความสำเร็จ เท็จเมื่อล้มเหลว |
---|---|
รุ่น PHP: | 4.0+ |
บันทึกการเปลี่ยนแปลง PHP: | PHP 5.3.1: อนุญาตให้เปลี่ยนชื่อไฟล์ข้ามไดรฟ์ใน Windows PHP 5.0: สามารถใช้ได้กับตัวตัด URL บางตัว |
❮ การอ้างอิงระบบไฟล์ PHP