Hàm đổi tên PHP ()
❮ Tham khảo hệ thống tập tin PHPVí dụ
Đổi tên thư mục + tập tin:
<?php
rename("images","pictures");
rename("/test/file1.txt","/home/docs/my_file.txt");
?>
Định nghĩa và cách sử dụng
Hàm đổi tên () đổi tên một tập tin hoặc thư mục.
Cú pháp
rename( old , new , context )
Giá trị tham số
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 |
Chi tiết kỹ thuật
Giá trị trả về: | ĐÚNG nếu thành công, SAI nếu thất bại |
---|---|
Phiên bản PHP: | 4.0+ |
Nhật ký thay đổi PHP: | PHP 5.3.1: Cho phép đổi tên file trên các ổ đĩa trong Windows. PHP 5.0: Có thể được sử dụng với một số trình bao bọc URL. |
❮ Tham khảo hệ thống tập tin PHP