保存到文件不适用于以下PHP代码

时间:2011-06-16 09:34:46

标签: php

我有以下代码,最近停止了工作。问题是没有数据写入文本文件“testFile.txt”

嗨,我有以下代码,最近停止了工作。问题是没有数据写入文本文件“testFile.txt”

<?php
$myFile = "testFile.txt";
$fh = fopen($myFile, 'a');
$IP = $_SERVER["REMOTE_ADDR"].',';
$logdetails=  $IP.date("F j, Y, g:i a O T");
$stringTimeout = $_POST['_delay'];
$stringData1 = $_POST['userChoices'];
$s = ',';
$postData = $s.$stringTimeout.$s.$stringData1."\n";
fwrite($fh,$logdetails.$postData, 'a');
fclose($fh);
header("Location: http://www.google.com");

exit;
?>

为什么会出现这种想法?

谢谢!

1 个答案:

答案 0 :(得分:3)

删除, 'a'中的fwrite($fh,$logdetails.$postData, 'a');See this document. :)