tmpfile

(PHP 4, PHP 5, PHP 7)

tmpfile锟斤拷锟斤拷一锟斤拷锟斤拷时锟侥硷拷

说锟斤拷

tmpfile ( void ) : resource

锟皆讹拷写锟斤拷w+锟斤拷模式锟斤拷锟斤拷一锟斤拷锟斤拷锟斤拷唯一锟侥硷拷锟斤拷锟斤拷锟斤拷时锟侥硷拷锟斤拷锟斤拷锟斤拷一锟斤拷锟侥硷拷锟斤拷锟斤拷锟�

锟侥硷拷锟斤拷锟节关闭猴拷锟斤拷 fclose()锟斤拷锟皆讹拷锟斤拷删锟斤拷锟斤拷锟津当脚憋拷锟斤拷锟斤拷锟斤拷

锟斤拷细锟斤拷息锟斤拷慰锟较低筹拷植锟斤拷械锟� tmpfile(3) 锟斤拷锟斤拷锟斤拷锟皆硷拷 stdio.h 头锟侥硷拷锟斤拷

锟斤拷锟斤拷值

锟斤拷锟斤拷一锟斤拷锟斤拷 fopen() 锟斤拷锟津开凤拷锟斤拷锟斤拷锟狡碉拷锟斤拷锟侥硷拷锟斤拷锟斤拷锟� 锟斤拷锟斤拷锟斤拷失锟斤拷时锟斤拷锟斤拷 FALSE.

锟斤拷锟斤拷

Example #1 tmpfile() 锟斤拷锟斤拷

<?php
$temp 
tmpfile();
fwrite($temp"writing to tempfile");
fseek($temp0);
echo 
fread($temp1024);
fclose($temp); // this removes the file
?>

锟斤拷锟斤拷锟斤拷锟教伙拷锟斤拷锟斤拷锟�

writing to tempfile

锟轿硷拷

  • tempnam() - 锟斤拷锟斤拷一锟斤拷锟斤拷锟斤拷唯一锟侥硷拷锟斤拷锟斤拷锟侥硷拷
  • sys_get_temp_dir() - 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷时锟侥硷拷锟斤拷目录