【发布时间】:2012-07-14 08:57:07
【问题描述】:
我不知道我到底哪里出错了。我已将问题缩小到 $file 没有被设置为任何东西,我不知道我哪里出错了。请帮忙:)
代码:($_GET['unit'] is 1)
$filepathhalf = "http://sureclean.netai.net/data/";
$date = date("Ymd");
$unitnum = $_GET['unit'];
$ext = ".txt";
$filepath = $filepathhalf.$unitnum.$date.$ext;
$bool = file_exists($filepath);
if($bool = true)
{
$fh = fopen($filepath, 'r');
$file = fread($fh, 4);
fclose($fh);
}
else{};
$file = strval($file);
echo $file;
你的网站/数据/120120714.txt:
true
【问题讨论】:
-
$bool = true可能不是您想要的,赋值 (=) 与比较 (==) 不同。