ฟังก์ชัน คัดลอก PHP ()
❮ การอ้างอิงระบบไฟล์ PHPตัวอย่าง
คัดลอก "source.txt" ไปที่ "target.txt":
<?php
echo copy("source.txt","target.txt");
?>
ความหมายและการใช้งาน
ฟังก์ชันคัดลอก () คัดลอกไฟล์
หมายเหตุ:หากมี ไฟล์ to_fileอยู่แล้ว ไฟล์นั้นจะถูกเขียนทับ
ไวยากรณ์
copy(from_file, to_file, context)
ค่าพารามิเตอร์
Parameter | Description |
---|---|
from_file | Required. Specifies the path to the file to copy from |
to_file | Required. Specifies the path to the file to copy to |
context | Optional. Specifies a context resource created with stream_context_create() |
รายละเอียดทางเทคนิค
คืนมูลค่า: | จริงกับความสำเร็จ เท็จเมื่อล้มเหลว |
---|---|
รุ่น PHP: | 4.0+ |
บันทึกการเปลี่ยนแปลง PHP: | PHP 5.3 - เพิ่มพารามิเตอร์บริบท |
❮ การอ้างอิงระบบไฟล์ PHP