PHP functions when PHP is disabled: Tempnam () after _php tutorial

Source: Internet
Author: User
Tags tmp file
When PHP is disabled PHP function: Tempnam (), Tempnam () can create a temporary file name will not be repeated with the files in the same directory.

The return string is the created temporary file name. If an error occurs, pass the go home string.

While the Smarty run must compile the directory in a similar Templates_c setting, and then run it will automatically create a similar

43^43b^43b32f4b%%index.htm.php temporary file, so, Tempnam () is disabled, of course, can not automatically create a similar percent

43^43b^43b32f4b%%index.htm.php temporary files, naturally automatically create similar percent
43^43b^43b32f4b%%index.htm.php temporary file, is a blank.

The program that uses the Tempnam function in Smarty is internals/core.write_file.php, the following code:

PHP Code:-----------------------------------------------------------------------
Write to TMP file, then rename it to avoid
File Locking race condition
$_tmp_file = Tempnam ($_dirname, ' wrt ');
if (! ( $FD = @fopen ($_tmp_file, ' WB ')) {
$_tmp_file = $_dirname. Directory_separator. Uniqid (' wrt ');
if (! ( $FD = @fopen ($_tmp_file, ' WB ')) {
$smarty->trigger_error ("Problem writing temporary file ' $_tmp_file '");
return false;
}
}
Fwrite ($FD, $params [' contents ']);
Fclose ($FD);


http://www.bkjia.com/PHPjc/445540.html www.bkjia.com true http://www.bkjia.com/PHPjc/445540.html techarticle when PHP is disabled PHP function: Tempnam (), Tempnam () can create a temporary file name will not be repeated with the files in the same directory. The return string is the created temporary file name. If there is an error ...

  • Related Article

    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.