Hướng dẫn php create temp file - php tạo tệp tạm thời

[Php 4, Php 5, Php 7, Php 8]

TMPFILE - Tạo một tệp tạm thờiCreates a temporary file

Sự mô tả

tmpfile []: tài nguyên | sai[]: resource|false

Tệp được tự động xóa khi đóng [ví dụ: bằng cách gọi fclose [] hoặc khi không có tài liệu tham khảo còn lại cho xử lý tệp được trả về bởi tmpfile []] hoặc khi tập lệnh kết thúc.fclose[], or when there are no remaining references to the file handle returned by tmpfile[]], or when the script ends.

Thận trọng

Nếu tập lệnh chấm dứt bất ngờ, tệp tạm thời có thể không bị xóa.

Thông số

Chức năng này không có tham số.

Trả về giá trị

Trả về một tay cầm tệp, tương tự như tệp được trả về bởi fopen [], cho tệp mới hoặc false về lỗi.fopen[], for the new file or false on failure.

Ví dụ

Ví dụ #1 tmpfile [] ví dụtmpfile[] example

Ví dụ trên sẽ xuất ra:

Xem thêm

  • Tempnam [] - Tạo tệp có tên tệp duy nhất
  • SYS_GET_TEMP_DIR [] - Trả về đường dẫn thư mục được sử dụng cho các tệp tạm thời

Giám mục ¶

4 năm trước

To get the underlying file path of a tmpfile file pointer:



The $setup variable is the contents of the textarea.

And I'm not sure if you need the fseek[$temp,0]; in there either, just leave it unless you know it doesn't effect it.

Ẩn danh ¶

6 năm trước

Since this function may not be working in some environments, here is a simple workaround:

0

1

2

3

thần thánh76 tại gmail dot com ¶

2 năm trước

5

6

7

Elm tại gmail dot nospamplease dot com ¶

3 năm trước

9

oremanj tại gmail dot com

15 năm trước

To get the underlying file path of a tmpfile file pointer:0

To get the underlying file path of a tmpfile file pointer:1

To get the underlying file path of a tmpfile file pointer:2

ssandor ¶

9 năm trước

To get the underlying file path of a tmpfile file pointer:4

Bài Viết Liên Quan

Chủ Đề