PHP salin () Fungsi
Referensi Sistem File PHPContoh
Salin "source.txt" ke "target.txt":
<?php
echo copy("source.txt","target.txt");
?>
Definisi dan Penggunaan
Fungsi copy() menyalin file.
Catatan: Jika file to_file sudah ada, itu akan ditimpa.
Sintaksis
copy(from_file, to_file, context)
Nilai Parameter
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() |
Detail Teknis
Nilai Kembali: | BENAR pada keberhasilan, SALAH pada kegagalan |
---|---|
Versi PHP: | 4.0+ |
Log Perubahan PHP: | PHP 5.3 - Menambahkan parameter konteks |
Referensi Sistem File PHP