[英]Why can't I see my .txt file from this php script
我正在使用此腳本來查看.text文件的內容-
<?php
$file = fopen("Gin_List_Website.txt","r");
if(!file)
{
echo("ERROR:cant open file .. :(");
}
else
{
echo("opened the file .. :)");
$buff = fread ($file,filesize("Gin_List_Website.txt"));
print $buff;
echo $buff;
}
?>
但是我只看到這條線
打開文件.. :)
我究竟做錯了什么?
首先,您需要使用if(!$ file)來更改if(!file)。
這是更簡單的代碼示例:
<?php
$file = fopen("Gin_list_Website.txt", "r") or die("Unable to open file!");
echo fread($file,filesize("Gin_list_Website.txt"));
fclose($file);
?>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.