Hàm hủy liên kết() trong PHP
❮ Tham khảo hệ thống tập tin PHPVí dụ
Xóa một tập tin:
<?php
$file = fopen("test.txt","w");
echo fwrite($file,"Hello World. Testing!");
fclose($file);
unlink("test.txt");
?>
Định nghĩa và cách sử dụng
Hàm unlink() xóa một tập tin.
Cú pháp
unlink( filename , context )
Giá trị tham số
Parameter | Description |
---|---|
filename | Required. Specifies the path to the file to delete |
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.0 - Đã thêm tham số ngữ cảnh |
❮ Tham khảo hệ thống tập tin PHP