讀取新建立的暫存檔案內容報錯的問題
LIWEN
LIWEN 2017-06-14 15:08:52
0
1
1288

<?php
//建立一個暫存檔案
$lsfile = tmpfile();

//向裡面寫入資料
$lsshuju = fwrite($lsfile, '111這裡是寫入臨時檔案的資料');

//輸出寫入情況
echo '向臨時檔案中寫入了' . $lsshuju . '個字元<br>' ;

//輸出暫存檔案的內容
$shuchu = file_get_contents($lsfile);
echo $shuchu;

//關閉暫存檔案
fclose($ lsfile);
?>


讀取內容報錯,請問如何讀取內容正確?

LIWEN
LIWEN

全部回覆(1)
左手右手慢动作

報什麼錯的

  • 回覆 向臨時文件中寫入了39個字符 Warning: file_get_contents() expects parameter 1 to be a valid path, resource given in /home/phpcn6peh2pwcun/wwwroot/compile.php(30) : eval()'d code on line 12
    LIWEN 作者 2017-06-15 09:02:41
  • 回覆 報錯的是$lsfile這個變數不是有效的路徑
    ringa_lee 作者 2017-06-15 09:14:49
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!