PHP ganti nama () Fungsi
Referensi Sistem File PHPContoh
Ganti nama direktori + file:
<?php
rename("images","pictures");
rename("/test/file1.txt","/home/docs/my_file.txt");
?>
Definisi dan Penggunaan
Fungsi rename() mengganti nama file atau direktori.
Sintaksis
rename(old, new, context)
Nilai Parameter
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 |
Detail Teknis
Nilai Kembali: | BENAR pada keberhasilan, SALAH pada kegagalan |
---|---|
Versi PHP: | 4.0+ |
Log Perubahan PHP: | PHP 5.3.1: Izinkan penggantian nama file di seluruh drive di Windows. PHP 5.0: Dapat digunakan dengan beberapa pembungkus URL. |
Referensi Sistem File PHP