search
Homephp教程php手册当PHP被禁用的PHP函数:tempnam() 后

  当PHP被禁用的PHP函数:tempnam() 后,tempnam()可建立一个临时档,档名不会与同目录中的档案重覆。

  传回字串就是建立的临时档名。若发生错误则传回空字串。
 
  而smarty运行就必须在类似templates_c的设置编译目录,然后运行后它会自动创建类似%%

  43^43B^43B32F4B%%index.htm.php的临时档,所以,tempnam()被禁用后,当然不能自动创建类似%%

  43^43B^43B32F4B%%index.htm.php的临时档,自然自动创建类似%%
  43^43B^43B32F4B%%index.htm.php的临时档,是一片空白.

  smarty中使用tempnam函数的程序是internals/core.write_file.php,如下代码:
<font size="2"><font face="Verdana">PHP代码:</font><hr></font><code><font color="#000000"><font color="#0000bb"><br></font><font color="#ff8000">// write to tmp file, then rename it to avoid<br> // file locking race condition<br>    </font><font color="#0000bb">$_tmp_file </font><font color="#007700">= </font><font color="#0000bb">tempnam</font><font color="#007700">(</font><font color="#0000bb">$_dirname</font><font color="#007700">, </font><font color="#dd0000">'wrt'</font><font color="#007700">);<br>    if (!(</font><font color="#0000bb">$fd </font><font color="#007700">= @</font><font color="#0000bb">fopen</font><font color="#007700">(</font><font color="#0000bb">$_tmp_file</font><font color="#007700">, </font><font color="#dd0000">'wb'</font><font color="#007700">))) {<br>        </font><font color="#0000bb">$_tmp_file </font><font color="#007700">= </font><font color="#0000bb">$_dirname </font><font color="#007700">. </font><font color="#0000bb">DIRECTORY_SEPARATOR </font><font color="#007700">. </font><font color="#0000bb">uniqid</font><font color="#007700">(</font><font color="#dd0000">'wrt'</font><font color="#007700">);<br>        if (!(</font><font color="#0000bb">$fd </font><font color="#007700">= @</font><font color="#0000bb">fopen</font><font color="#007700">(</font><font color="#0000bb">$_tmp_file</font><font color="#007700">, </font><font color="#dd0000">'wb'</font><font color="#007700">))) {<br>            </font><font color="#0000bb">$smarty</font><font color="#007700">-></font><font color="#0000bb">trigger_error</font><font color="#007700">(</font><font color="#dd0000">"problem writing temporary file '$_tmp_file'"</font><font color="#007700">);<br>            return </font><font color="#0000bb">false</font><font color="#007700">;<br>        }<br>    }<br>   </font><font color="#0000bb">fwrite</font><font color="#007700">(</font><font color="#0000bb">$fd</font><font color="#007700">, </font><font color="#0000bb">$params</font><font color="#007700">[</font><font color="#dd0000">'contents'</font><font color="#007700">]);<br>   </font><font color="#0000bb">fclose</font><font color="#007700">(</font><font color="#0000bb">$fd</font><font color="#007700">);<br></font><font color="#0000bb"></font></font></code><hr>



Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)