PHP function when PHP is disabled: tempnam()_PHP tutorial

WBOY
Release: 2016-07-20 11:00:03
Original
1008 people have browsed it

When PHP is disabled using the PHP function: tempnam(), tempnam() can create a temporary file, and the file name will not be duplicated with files in the same directory.

The string returned is the temporary file name created. If an error occurs, an empty string is returned.

To run smarty, you must set up a compilation directory similar to templates_c, and then after running it will automatically create something like %%

  43^43B^43B32F4B%%index.htm.php Temporary file, so after tempnam() is disabled, of course it cannot automatically create something like %%

The temporary file of 43^43B^43B32F4B%%index.htm.php will naturally be automatically created like %%
The temporary file of 43^43B^43B32F4B%%index.htm.php is 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);


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445540.htmlTechArticleWhen PHP is disabled PHP function: tempnam(), tempnam() can create a temporary file with the file name Will not be duplicated with files in the same directory. The string returned is the temporary file name created. If an error occurs...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!