当PHP被禁用的PHP函数:tempnam() 后

王朝php·作者佚名  2006-11-24
窄屏简体版  字體: |||超大  

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

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航