How to use PHP to create a unique temporary file

Source: Internet
Author: User
How to use PHP to create a unique temporary file $ tmpfiletempnam (getcwd ()., TMP); create a unique temporary file tempnam -- create a file syntax with a unique File name: stringtempnam (stringdir, stringprefix) tempnam is used to create a unique temporary file using prefix in the specified directory.
$ Tmpfile = tempnam (getcwd (). "/", "TMP"); // create a unique temporary file

Tempnam -- create a file with a unique file name
Syntax: string tempnam (string dir, string prefix)
Tempnam is a unique temporary file prefixed with prefix (TMP (*) created under the specified directory (*). tmp), the suffix of the file name is tmp, the prefix passed here, the maximum length is 3, if more than 3, the following will be truncated. For example, if you write TEMP, only the TEM is used as the prefix.
In addition, the getcwd function obtains the current working directory (get current work dir ).

// Current directoryecho getcwd (). "\ n"; // echo/home/didouchdir ('CVS '); // current directoryecho getcwd (). "\ n"; // echo/home/didou/cvs
?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.