이 코드가 있는데 거기에 버그가 있지만 어디서 잘못 읽었는지 알 수 없습니다. 누군가 도와 주실 수 있습니까? 문제는 텍스트 파일의 내용을 부식시키기 위해 특정 이미지를 표시하려고한다는 것입니다. 차이가PHP - If 및 else 문
<?php
if (empty($_GET['unit'])) {
$output="Please Enter A Unit Number";
echo $output;
}
else {
$filepathhalf = "/data/";
$file = "false";
$date = date("Ymd");
$unitnum = $_GET['unit'];
$ext = ".txt";
$filepath = $filepathhalf.$unitnum.$date.$ext;
echo $filepath;
echo $file;
if(file_exists($filepath))
{
$fh = fopen($filepath, 'r');
$file = fread($fh, 5);
fclose($fh);
}
echo $file; //This echo comes back as false as set but the green.png image still displays.
if ($file = "true ")
{
echo "<img src=\"images/green.png\" width=\"15\" height=\"15\" />";
}
else
{
echo "<img src=\"images/red.png\" width=\"15\" height=\"15\" />";
}
echo $_GET['unit'];
}
?>
감사합니다 그냥 원인 내가 할 수있는 단 하나의 accpept .. – Nick
당신이 하나의 파일에 우려를 혼합하지 않아야하지만, if ($ file) :?> endif;' – Dan