如何将 IF THEN 表达式放入 PHP 函数中fwrite
?下面给出的代码不能正常工作。请看线fwrite($fh, "$row[0]...)
。
$myFile = "testFile.php";
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh, "lat lon title description iconOffset icon\n");
foreach ($result4 as $row):
fwrite($fh, "$row[0] $row[1] $row[2] Resource average speed is: $row[3] km/h -10,-10 if($row[4]==0) images/markerRed.png else images/markerGreen.png\n");
endforeach;
fclose($fh);
?>