當PHP被禁用的PHP函數:tempnam()後

來源:互聯網
上載者:User

當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,如下代碼:

PHP代碼:-----------------------------------------------------------------------
// 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);

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.