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);