$tempFile = tempnam(sys_get_temp_dir(), 'temp'); $fhandle = fopen($tempFile, 'w'); fwrite($fhandle, $data);//$data为需要写入的数据 fclose($fhandle); unlink($tempFile);