Hướng dẫn php temp upload directory - thư mục tải lên tạm thời php

[Php 5> = 5.2.1, Php 7, Php 8]

SYS_GET_TEMP_DIR - Trả về đường dẫn thư mục được sử dụng cho các tệp tạm thờiReturns directory path used for temporary files

Sự mô tả

sys_get_temp_dir []: chuỗi[]: string

Thông số

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

Trả về giá trị

Trả về đường dẫn của thư mục tạm thời.

Ví dụ

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

Ví dụ trên sẽ xuất ra một cái gì đó tương tự như:

C:\Windows\Temp\TuxA318.tmp

Xem thêm

  • tmpfile [] - tạo một tệp tạm thời
  • Tempnam [] - Tạo tệp có tên tệp duy nhất

Osakawebbie ¶

5 năm trước

If running on a Linux system where systemd has PrivateTmp=true [which is the default on CentOS 7 and perhaps other newer distros], this function will simply return "/tmp", not the true, much longer, somewhat dynamic path.

Royanee tại Yahoo Dot Com ¶

8 năm trước

As of PHP 5.5.0, you can set the sys_temp_dir INI setting so that this function will return a useful value when the default temporary directory is not an option.

Ẩn danh ¶

14 năm trước

This function does not always add trailing slash. This behaviour is inconsistent across systems, so you have keep an eye on it.

Ẩn danh ¶

14 năm trước

it should be mentioned that the return value of sys_get_temp_dir[] can be set using the ini-directive 'sys_temp_dir' globally as well as per directory by using
php_admin_value sys_temp_dir /path/to/tmp

7 năm trước

14 năm trước

A very helpful thing to note when on Linux:

If you are running PHP from the commandline you can use the environment variable: TMPDIR - to change the location without touching php.ini. - This should work on most versions of PHP.

0

Bài Viết Liên Quan

Chủ Đề