Hàm unlink () trong PHP
❮ Tham chiếu hệ thống tệp PHPThí dụ
Xóa tệp:
<?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.
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ả lại: | ĐÚNG về thành công, SAI về thất bại |
---|---|
Phiên bản PHP: | 4.0+ |
PHP Changelog: | PHP 5.0 - Đã thêm tham số ngữ cảnh |
❮ Tham chiếu hệ thống tệp PHP