Để thêm nút, bạn có thể sử dụng thư viện jQuery hoặc tập lệnh JavaScript đơn giản như được hiển thị bên dưới:button you may use either jQuery libraries or simple Javascript script as shown below:
Liên kết hoặc nút HTML: link or button:
click event
Javascript:
var btn = document.getElementById['button'];
function goclear[] {
alert["Handler called. Page will redirect to clear.php"];
document.location.href = "clear.php";
};
Sử dụng PHP để xóa nội dung tệp. Ví dụ, bạn có thể sử dụng FSEEK [$ FP, 0]; hoặc ftruncate [tài nguyên $ file, int $ size] Như dưới đây:PHP to clear a file content. For instance you can use the fseek[$fp, 0]; or ftruncate [ resource $file , int $size ] as below:
Chuyển hướng PHP - Bạn có thể sử dụng tiêu đề [Chuỗi $ chuỗi [, bool $ thay thế = true [, int $ http_response_code]]]]PHP - you can use header [ string $string [, bool $replace = true [, int $http_response_code ]] ]
Tôi hy vọng nó sẽ giúp.
[Php 4, Php 5, Php 7, Php 8]
ftruncate - cắt một tệp thành một độ dài nhất định — Truncates a file to a given length
Sự mô tả
ftruncate [tài nguyên $stream
, int $size
]: bool[resource $stream
, int $size
]: bool
Thông số
stream
Con trỏ tập tin.
________số 8Ghi chú::
stream
phải được mở để viết.
Kích thước để cắt ngắn.
Ghi chú::
stream
phải được mở để viết.________số 8
Kích thước để cắt ngắn.
Nếu size
lớn hơn tệp thì tệp được mở rộng với các byte null.
1 on success or
var btn = document.getElementById['button'];
function goclear[] {
alert["Handler called. Page will redirect to clear.php"];
document.location.href = "clear.php";
};
2 on failure.
var btn = document.getElementById['button'];
function goclear[] {
alert["Handler called. Page will redirect to clear.php"];
document.location.href = "clear.php";
};
Nếu size
nhỏ hơn tệp thì tệp bị cắt theo kích thước đó.
Trả về giá trị
var btn = document.getElementById['button'];
function goclear[] {
alert["Handler called. Page will redirect to clear.php"];
document.location.href = "clear.php";
};
3 Trả về
var btn = document.getElementById['button'];
function goclear[] {
alert["Handler called. Page will redirect to clear.php"];
document.location.href = "clear.php";
};
1 khi thành công hoặc
var btn = document.getElementById['button'];
function goclear[] {
alert["Handler called. Page will redirect to clear.php"];
document.location.href = "clear.php";
};
2 về thất bại.
var btn = document.getElementById['button'];
function goclear[] {
alert["Handler called. Page will redirect to clear.php"];
document.location.href = "clear.php";
};
var btn = document.getElementById['button'];
function goclear[] {
alert["Handler called. Page will redirect to clear.php"];
document.location.href = "clear.php";
};
Ghi chú::
stream
phải được mở để viết.
________số 8
- Kích thước để cắt ngắn.
- Nếu
size
lớn hơn tệp thì tệp được mở rộng với các byte null.
Nếu size
nhỏ hơn tệp thì tệp bị cắt theo kích thước đó. ¶
Trả về giá trị
var btn = document.getElementById['button'];
function goclear[] {
alert["Handler called. Page will redirect to clear.php"];
document.location.href = "clear.php";
};
4
var btn = document.getElementById['button'];
function goclear[] {
alert["Handler called. Page will redirect to clear.php"];
document.location.href = "clear.php";
};
5
var btn = document.getElementById['button'];
function goclear[] {
alert["Handler called. Page will redirect to clear.php"];
document.location.href = "clear.php";
};
6
var btn = document.getElementById['button'];
function goclear[] {
alert["Handler called. Page will redirect to clear.php"];
document.location.href = "clear.php";
};
7 Trả về
1 khi thành công hoặc
var btn = document.getElementById['button'];
function goclear[] {
alert["Handler called. Page will redirect to clear.php"];
document.location.href = "clear.php";
};
2 về thất bại. ¶
var btn = document.getElementById['button'];
function goclear[] {
alert["Handler called. Page will redirect to clear.php"];
document.location.href = "clear.php";
};
Ví dụ
var btn = document.getElementById['button'];
function goclear[] {
alert["Handler called. Page will redirect to clear.php"];
document.location.href = "clear.php";
};
8Ví dụ: Ví dụ về tệp số 1 ¶
Ghi chú
var btn = document.getElementById['button'];
function goclear[] {
alert["Handler called. Page will redirect to clear.php"];
document.location.href = "clear.php";
};
9
0
1
var btn = document.getElementById['button'];
function goclear[] {
alert["Handler called. Page will redirect to clear.php"];
document.location.href = "clear.php";
};
7Con trỏ tệp không thay đổi. ¶
Trả về giá trị
3 Trả về
1 khi thành công hoặc
var btn = document.getElementById['button'];
function goclear[] {
alert["Handler called. Page will redirect to clear.php"];
document.location.href = "clear.php";
};
2 về thất bại. ¶
var btn = document.getElementById['button'];
function goclear[] {
alert["Handler called. Page will redirect to clear.php"];
document.location.href = "clear.php";
};
Ví dụ
4
5
6
7Ví dụ: Ví dụ về tệp số 1