亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

php creates temporary files

The files we created before are permanent files.

Creating temporary files is also very useful in our daily project development. Several benefits of creating temporary files:

Delete after finishing writing

No need to maintain the deletion status of this file

For example: I need to transfer the content of A’s file Save it in B and transfer the file contents of B to C.

Just like in real life, I can first use a temporary bottle to fill B's water, and then write A's data into B. Add the water from the temporary bottle to C.

Let’s learn this function:

resource tmpfile ( )

Function: Create a temporary file and return the resource type. The file is deleted when it is closed.

<?php
   //創(chuàng)建了一個(gè)臨時(shí)文件
   $handle = tmpfile();

   //向里面寫(xiě)入了數(shù)據(jù)
   $numbytes = fwrite($handle, '寫(xiě)入臨時(shí)文件');

   //關(guān)閉臨時(shí)文件,文件即被刪除
   fclose($handle);

   echo  '向臨時(shí)文件中寫(xiě)入了'.$numbytes . '個(gè)字節(jié)';
?>


Continuing Learning
||
<?php //創(chuàng)建了一個(gè)臨時(shí)文件 $handle = tmpfile(); //向里面寫(xiě)入了數(shù)據(jù) $numbytes = fwrite($handle, '寫(xiě)入臨時(shí)文件'); //關(guān)閉臨時(shí)文件,文件即被刪除 fclose($handle); echo '向臨時(shí)文件中寫(xiě)入了'.$numbytes . '個(gè)字節(jié)'; ?>
submitReset Code